k8s commands 04

2021. 10. 31. 12:00·Programming

kubectl get pods --selector env=dev

kubectl get pods --selector bu=finance

kubectl get all

kubectl get all --selector env=prod

kubectl get pods --selector env=prod,bu=finance,tier=frontend

 

kubectl taint nodes NODE_NAME key=value:TAINT_EFFECT

kubectl taint nodes node1 app=blue:NoSchedule

kubectl describe node kubemaster | grep Taint

 

kubectl get nodes

kubectl describe node node01 | grep Taints

kubectl taint nodes node01 spray=mortein:noSchedule

apiVersion: v1
kind: Pod
metadata:
  name: bee
spec:
  containers:
  - image: nginx
    name: bee
  tolerations:
  - key: spray
    value: mortein
    effect: NoSchedule
    operator: Equal

kubectl taint nodes controlplane node-role.kubernetes.io/master:NoSchedule-

 

kubectl label nodes NODE_NAME LABEL_KEY=LABEL_VALUE

kubectl label nodes node-1 size=Large

kubectl label nodes node01 color=blue

kubectl create deployment blue --image=nginx --replicas=3

kubectl describe node controlplane | grep -i taints

 

kubectl get pods -o wide

kubectl get pods -o wide | grep XXX

 

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: blue
spec:
  replicas: 3
  selector:
    matchLabels:
      run: nginx
  template:
    metadata:
      labels:
        run: nginx
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: color
                operator: In
                values:
                - blue

 

 

kind: Deployment
metadata:
  name: red
spec:
  replicas: 2
  selector:
    matchLabels:
      run: nginx
  template:
    metadata:
      labels:
        run: nginx
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: Exists

 

'Programming' 카테고리의 다른 글

좋은 글  (1) 2021.11.07
macOS Monterey의 5000번 포트  (0) 2021.11.04
k8s commands 03  (0) 2021.10.26
k8s commands 02  (0) 2021.10.25
k8s commands 01  (0) 2021.10.23
'Programming' 카테고리의 다른 글
  • 좋은 글
  • macOS Monterey의 5000번 포트
  • k8s commands 03
  • k8s commands 02
Doljae
Doljae
  • Doljae
    Zero to Hero
    Doljae
  • 전체
    오늘
    어제
    • 분류 전체보기 (349)
      • Programming (54)
      • Algorithm (161)
      • Review (102)
      • Career (8)
      • Diary (18)
      • Shorts (4)
      • Temp (2)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
    • 글 쓰기
    • 관리
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    공채
    코딩테스트
    2023
    백준
    PYTHON
    라인
    프로그래머스
    db
    2021
    sql
    database
    인프콘
    mysql
    컨퍼런스
    한빛미디어
    나는리뷰어다
    나는 리뷰어다
    개발자
    leetcode
    sql튜닝
    코딩
    BOJ
    ChatGPT
    2022
    AI
    java
    면접
    회고
    line
    jpa
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.4
Doljae
k8s commands 04
상단으로

티스토리툴바