Hello SRE or Platform Engineer or DevOps Engineers, In this post I want to discuss, Understanding of Kubernetes deployment it's hierarchy of kube objects. Declaratives and imperative ways to make deployment on kube clusters.
How to deploy an application on Kubernetes pods, just follow these steps as shown in this post.
Here I would like to share with you about Kubernetes deployment hierarchy, which internal call to replication controller to make desired number of replicas of pod temple specified.
Kubernetes Deployment hierarchy |
Let's goto have a deep understanding about Kubernetes deployment hierarchy
Step 1: We need to create a YAML file to define the deployment of the Nginx Webserver. Here we are taking a file name as Nginx-deployment.
Command :
k create deploy httpd-deploy --image=httpd:alpine --dry-run=client -o yaml k create deploy httpd-deploy --image=httpd:alpine --dry-run=client -o yaml >httpd-deploy.yaml vi httpd-deploy.yaml # Insert the following manifestation for deployment using httpd:apline image apiVersion: apps/v1 kind: Deployment metadata: labels: app: httpd-deploy name: httpd-deploy spec: replicas: 1 selector: matchLabels: app: httpd-deploy strategy: {} template: metadata: labels: app: httpd-deploy spec: containers: - image: httpd:alpine name: httpd k create -f httpd-deploy.yaml #create k get deploy,po #confirmation
kubectl get deployments # or use alias name kubectl get deploy # or use alternative name kubectl get deployment2. Describe the Deployment details
kubectl describe deploy web-deploymentDeployments contains Pods and its Replica information.
3. To Show Rollout History of the given Deployment
kubectl rollout history deployment web-deployment4. Updates the existing deployment using update application new version. Do some R&D work here. Goto the Docker Hub find the Niginx tags consider the version tags to deploy. Currently I could see 1.22.0 and 1.23.1 versioned tags. So start with the new deployment with nginx:1.22.0 image after the pods up and application looks good we can update to the latest version that is nginx:1.23.1 versioned image.
k create deploy web-deploy --image=nginx:1.22 --replicas=2 k get deploy,po -o wide # upgrade to new version 1.24 k set image deploy/web-deploy nginx=nginx:1.24 k get deploy,po -o wide5. Rolls back or roll Forward to a specific version
kubectl create –f app-deploy.yml kubectl get deploy app-deploy kubectl apply –f app-deploy.yml --record kubectl rollout undo deployment app-deploy - -to-revision=1 kubectl rollout undo deployment app-deploy - -to-revision=2
No comments:
Post a Comment