Create a deployment with the following properties:
- called "blufer"
- using the image "python"
- runs 3 replicas
- all pods will be placed on a node that has the label "blufer"
Answer
kubectl create deployment blufer --image=python --replicas=3 -o yaml --dry-run=client > deployment.yaml
Add the following section (vi deployment.yaml):
spec:
affinity:
nodeAffinity:
requiredDuringSchedlingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: blufer
operator: Exists
kubectl apply -f deployment.yaml