Deployments with YAML¶
Step-01: Copy templates from ReplicaSet¶
- Copy templates from ReplicaSet and change the
kind: Deployment - Update Container Image version to
3.0.0 - Update NodePort service
nodePort: 31233 - Change all names to Deployment
- Change all labels and selectors to
myapp3
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp3-deployment
spec:
replicas: 3
selector:
matchLabels:
app: myapp3
template:
metadata: # Dictionary
name: myapp3-pod
labels: # Dictionary
app: myapp3
spec:
containers: # List
- name: myapp3-container
image: stacksimplify/kubenginx:3.0.0
ports:
- containerPort: 80
# Create Deployment
kubectl apply -f 02-deployment-definition.yml
kubectl get deploy
kubectl get rs
kubectl get po
# Create NodePort Service
kubectl apply -f 03-deployment-nodeport-service.yml
# List Service
kubectl get svc
# Get Public IP
kubectl get nodes -o wide
# Access Application
http://<Worker-Node-Public-IP>:31233
API References¶
- Deployment: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#deployment-v1-apps
AWS EKS - Elastic Kubernetes Service - Masterclass¶
🎉 New Course
Ultimate DevOps Real-World Project Implementation on AWS
$15.99
$84.99
81% OFF
APRIL2026
Enroll Now on Udemy
🎉 Offer
