Question
Perform required steps to deploy new pod with label env=prod ONLY on k8s-node-01.
Answer
Generate pod manifest:
kubectl run nginx --image=nginx -l env=prod --dry-run=client -o yaml
Adjust it:
apiVersion: v1
kind: Pod
metadata:
labels:
env: prod
name: nginx
spec:
containers:
- image: nginx
name: nginx
nodeSelector:
kubernetes.io/hostname: k8s-node-01
Verify:
kubectl apply -f po.yaml
kubectl get po -w
kubectl get po -o wide