Hi @pratikshag
I found some syntax error(s) in your Deployment file.
Here is the corrected file:
vi deployment.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: blue
name: blue
spec:
replicas: 3
selector:
matchLabels:
app: blue
template:
metadata:
labels:
app: blue
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: color
operator: In
values:
- blue
containers:
- image: nginx:latest
name: nginx-container
save & exit
create deployment :
------------------------
kubectl apply -f deploy.yml
deployment.apps/blue created
check if pods are running:
----------------------------------
controlplane $ kubectl get pods
NAME READY STATUS RESTARTS AGE:
blue-f7c59c79f-5dncq 1/1 Running 0 6m29s
blue-f7c59c79f-8h6p7 1/1 Running 0 6m29s
blue-f7c59c79f-kv9jb 1/1 Running 0 6m29s
Good Luck !