[k8s] Taints & Tolerations ============ ###### tags: `kubernetes` `scheduling` > 不保證有`tolerations`的pod一定會部署在被`taint`的node > > 因為如果先遇到沒有任何`taint`時,會優先部署 # Add taints to Node ```sh= kubectl taint nodes node-name key=value:taint-effect ``` ## taint effect + what happend to PODs that DO NOT TOLERATE this taint? + types of taint-effect + NoSchedule | PreferNoSchedule | NoExecute + `NoSchedule`: no scheduled or evicted from existing nodes ```shell= kubectl taint nodes node1 app=blue:NoSchedule ``` ## remove taint on controlplane ```shell= kubectl taint nodes controlplane node-role.kubernetes.io/control-plane:NoSchedule- ``` # Add toleration to PODs ```yaml= # pod-definition.yaml apiVersion: v1 kind: Pod metadata: name: myapp-pod spec: containers: - name: nginx-container image: nginx tolerations: - key: app operator: Equal value: blue effect: NoSchedule ``` 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up