Kubernetes (also known as k8s or “kube”) is an open source container orchestration platform that automates many of the manual processes involved in deploying, managing, and scaling containerized applications.
In other words, you can cluster together groups of hosts running Linux containers, and Kubernetes helps you easily and efficiently manage those clusters.

Kubernetes Components

A Kubernetes cluster consists of a set of worker machines, called nodes, that run containerized applications. Every cluster has at least one worker node.

The worker node(s) host the Pods that are the components of the application workload. The control plane manages the worker nodes and the Pods in the cluster. In production environments, the control plane usually runs across multiple computers and a cluster usually runs multiple nodes, providing fault-tolerance and high availability.

Kubernetes Components :-

Kubernetes Integration with Python-CG

In this practical we are trying to interested k8s , JavaScript using Python CGI in this interrogation there are some features we can perform


👉 It can launch pods with specific name given by user.

👉 Run deployment using image and name given by user.

👉 Expose services on given user input port number.

👉 Scale the replica according to user need.

👉 Delete complete environment created.

👉 Delete specific resources given by user.

Step 1-Start mini cube setup using minicube start command

Step2 : create python file containing our backend code

§ import modules of cgi and subprocess

§ From cgi module import FieldStorage function.

§ Taking input in X : variable_name.getvalue in input format “x”

§ For final output We have to use subprocess module i.e getoutput()

NOTE: For Further process/code we need to provide admin.conf file which contains all the information of kubernetes cluster; its ip adresss

§we use input.split() function, which splites API request that containes three components id ,image name ,pod/deployment name and stores it into command variable.

§if loop checks the id of the command

“id =1 : Creates deployment”

“id =2 : Runs pod”

“id =3 : Deletes pod”

“id =4 : deletes deployment”

“id =5 : expose deployment”

“id =6 : Scales deployment”



“id =9: deletes all environment”

Step 3: Create html file containing Javsacript and Html body

§ Put Function containing which handles XMLHttp request

§ Create varible xhr containing Ip address of backend code server and provide backend.py file

§ Get the input from getElementby Id method.

§ Create body tag containing front end UI

§ Create input field and button to run command and hit output.

§ Create Lw() function

Here, idd variable describes which command to run i.e. 1 :create deployment , 2: Run Pod etc.

final variable contains information of all id ,pod name ,image name as per selected command option from above id.






Git repo :- https://github.com/rohit9545/Task-9.git

Thank you for Time..!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store