🔴 FREE LIVE WEBINAR
How to Become a DevOps Engineer in 2027
From Zero to DevOps Champion!
November 21st, 2026
9:30 AM CST
Live DevSecOps CI/CD Demo
Career Roadmap • Live Q&A
REGISTER FOR FREE →
100% FREE • Live on Zoom
🎁 FREE CAREER GUIDE
2027 AI-Enabled DevSecOps Career Roadmap
Your Career Journey Starts Here!
📘
9-Stage Learning Roadmap
15-Week Study Plan
8-Page PDF + 12 Interview Q&As
GET FREE ROADMAP →
100% FREE • Delivered to Your Inbox
🚀 NEW WEEKEND BATCH
AI-Enabled DevSecOps & Cloud Engineering Bootcamp
Starts December 5th, 2026
Sat: 9:30 AM – 11:30 AM CST
Sun: 10:30 AM – 12:30 PM CST

15 Weeks • 70+ Labs • Live Training
REGISTER FOR BOOTCAMP → Explore Bootcamp →
Enrollment Open!
3,500+ Students Trained
25+ Years of IT Experience
70+ Hands-On Labs
🔴 Free Webinar Register Free
🎁 Free Roadmap Get Roadmap
🚀 Weekend Batch Enroll Now →

Friday, May 7, 2021

Deploy Python App into Kubernetes Cluster using kubectl Jenkins Pipeline | Containerize Python App and Deploy into AKS Cluster | Kubectl Deployment using Jenkins

We will learn how to automate Docker builds using Jenkins and Deploy into Kubernetes Cluster(AKS) in Azure Cloud. We will use kubectl command to deploy Docker images into AKS cluster. We will use Python based application. I have already created a repo with source code + Dockerfile. The repo also have Jenkinsfile for automating the following:


- Automating builds using Jenkins
- Automating Docker image creation
- Automating Docker image upload into Docker registry
- Automating Deployments to Kubernetes Cluster using kubectl CLI plug-in
 

 

Pre-requistes:
1. AKS Cluster is setup and running. Click here to learn how to create AKS cluster.
2. Jenkins Master is up and running.
3. Docker, Docker pipeline and Kubectl CLI plug-ins are installed in Jenkins





5. Azure container registry is setup in https://portal.azure.com


Step #1 - Create Credentials for Acure Container Registry
Go to Jenkins UI, click on Credentials -->


Click on Global credentials
Click on Add Credentials


Now Create an entry for connecting to ACR. Make sure you enter the ID as ACR



Step #3 - Create Credentials entry for AKS Cluster
Click on Add Credentials, use Kubernetes configuration from drop down.



execute the below command to get kubeconfig info, copy the entire content of the file:
sudo cat ~/.kube/config


Enter ID as K8S and choose enter directly and paste the above file content and save.


Step # 4 - Create a pipeline in Jenkins
Create a new pipeline job.


Step # 5 - Copy the pipeline code from below
Make sure you change red highlighted values below:
Your docker user id should be updated.
your registry credentials ID from Jenkins from step # 1 should be copied



Step # 6 - Build the pipeline
Once you create the pipeline and changes values per your Docker user id and credentials ID, click on 



Step # 7 - Verify deployments to K8S

kubectl get pods


kubectl get deployments
kubectl get services

Steps # 8 - Access Python App in K8S cluster
Once build is successful, go to browser and enter master or worker node public ip address along with port number mentioned above
http://master_or_worker_node_public_ipaddress:port_no_from_above

You should see page like below:


Please watch the above steps in YouTube channel:

No comments:

Post a Comment