[Mock3_6] taint

유유·2023년 1월 31일
0

CKA

목록 보기
6/19

https://kubernetes.io/ko/docs/concepts/scheduling-eviction/taint-and-toleration/

Taint the worker node node01 to be Unschedulable. Once done, create a pod called dev-redis, image redis:alpine, to ensure workloads are not scheduled to this worker node. Finally, create a new pod called prod-redis and image: redis:alpine with toleration to be scheduled on node01.

key: env_type, value: production, operator: Equal and effect: NoSchedule

Key = env_type

Value = production

Effect = NoSchedule

pod 'dev-redis' (no tolerations) is not scheduled on node01?

Create a pod 'prod-redis' to run on node01

*template*

kubectl taint nodes node1 key1=value1:NoSchedule

*solve*
kubectl taint nodes node01 env_type=production:NoSchedule
   
k run dev-redis --image=redis:alpine

k run prod-redis --image=redis:alpine --dry-run=client -o yaml > taint.yaml

vim taint.yaml 

---
piVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: prod-redis
  name: prod-redis
spec:
  containers:
  - image: redis:alpine
    name: prod-redis
    resources: {}
  dnsPolicy: ClusterFirst
  restartPolicy: Always
  tolerations:
  - key: "env_type"
    value: "production"
    effect: "NoSchedule"
status: {}

---
k apply -f taint.yaml 
profile
하이

0개의 댓글