CKAD

2. Configuration

백셀건전지 2022. 4. 18. 18:18

Commands and Arguments

Dockerfile의 ENTRYPOINT, COMMAND와 K8S Pod의 command, arg와의 관계

  • pod의 args 없이 command만 선언하면 Dockerfile의 ENTRYPOINT와 COMMAND를 덮어 써서 pod의 command만 실행된다.
  • pod의 command 없이 args만 선언하면 Dockerfile의 COMMAND를 덮어 써서 ENTRYPOINT의 인자로 명령어가 실행된다.

Security Contexts

pod의 실행 user 확인하는 명령어

kubectl exec <POD_NAME> -- whoami

Taint and Tolerations

Taint 삭제 명령어 (끝에 - 추가)

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

Affinity

node 대상 affinity 설정은 labelSelector가 아닌 nodeSelectorTerms로 적용한다.

labelSelector와 nodeSelectorTerms가 다른 점은 topologyKey가 필요하지 않음.

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

key 값 존재만 확인하려면 operator를 Exists로 생성한다.

'CKAD' 카테고리의 다른 글

Admission Controller  (0) 2022.04.26
Practice Test  (0) 2022.04.26
Lightning Lab  (0) 2022.04.22
6. State Persistence  (0) 2022.04.21
4. Pod Design  (0) 2022.04.19