The directory ~/manifests-16skyz2 exists and is empty. The namespace anatomy-16skyz2 exists and is empty.
1. Generate
sh
kubectl create deploy web --image=nginx:1.27 --dry-run=client -o yaml > ~/manifests-16skyz2/web.yaml
cat ~/manifests-16skyz2/web.yaml2. Edit
The generator wrote replicas: 1. Change it to 3. Either open the file:
sh
vim ~/manifests-16skyz2/web.yamlor substitute in place:
sh
sed -i 's/replicas: 1/replicas: 3/' ~/manifests-16skyz2/web.yaml
grep replicas ~/manifests-16skyz2/web.yaml3. Apply
sh
kubectl apply -f ~/manifests-16skyz2/web.yaml -n anatomy-16skyz2
kubectl get deploy web -n anatomy-16skyz2READY should reach 3/3.
4. A Service, by hand
Write ~/manifests-16skyz2/web-svc.yaml. It needs apiVersion: v1, kind: Service, a name of web, a selector of app: web (the label the generator put on the Pods) and one port, 80 to 80:
yaml
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 80
targetPort: 80Apply it to the same namespace and confirm it found its Pods:
sh
kubectl apply -f ~/manifests-16skyz2/web-svc.yaml -n anatomy-16skyz2
kubectl describe svc web -n anatomy-16skyz2The Endpoints: line lists three Pod IPs. If it shows <none>, the selector does not match the Pod labels.