Day 05  Deployment Service EKS.

Day 05 Deployment Service EKS.

What is a Deployment service? How to scale it?

(1) What is Deployment?

A Deployment provides declarative updates for Pods and ReplicaSets.

(2) Creating Deployment.

  • Create Deployment

kubectl create -f nginx-deployment.yaml

Check Deployments

  • Get the list of Created Deployment
# Verify Deployment
kubectl get deployments
kubectl get deploy 

# Describe Deployment
kubectl describe deployment my-first-deployment

# Verify ReplicaSet
kubectl get rs

# Verify Pod
kubectl get po

(3) Scaling Deployment

# Scale Up the Deployment
kubectl scale --replicas=20 deployment/nginx

# Delete a running pod.
kubectl get pods
kubectl delete pod <pod-name>

# verify newly created pod is working.
kubectl get pod

(4) Scaling Deployment with yaml

  • In nginx-deployment.yaml file, key :replicas is indicate number of pods.Currently it sets as 3 you can change it to 5.
# Before
spec:
  replicas: 3

# After
spec:
  replicas: 5
  • Update the ReplicaSet
# Below command will again read the file and change the replicas.
kubectl apply -f nginx-deployment.yaml

# To check newly created pods.
kubectl get pods

(5) Expose Deployment Service

  • Exposing deployment allows us to access the service from the internet.(NodePort)
# Expose Deployment Service
kubectl expose deployment nginx-deployment --type=NodePort --port=80 --target-port=80 --name=nginx-deployment-service

# find nodeport port
kubectl get svc

# Get Public IP of Worker Nodes
kubectl get nodes -o wide

Access the Application using Public IP

http://: <node-public-ip> : <nodeport-port>

Made with :heart: by Pratikkumar Panchal. https://github.com/m3pratik/31daysofEKS