Kubernetes Integration with Python-CGI and JavaScript.
_Task Description_ 📄
👉Integrate Kubernetes commands that can be run through webUI created by you.
👉WebUI page can use normal English conversation to run all the commands in the background.
*Example* - when we write 'run deployment using httpd image' then it run complete *deployment command* in backend.
*Features*
👉 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.
📌 *This app will help the user to run all the Kubernetes commands*:
👉 Make a blog/article/video explaining this task step by step.
Kubernetes:
First let’s see some information about kubernetes.
Containers are a good way to bundle and run your applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if a container goes down, another container needs to start. Wouldn't it be easier if this behavior was handled by a system?
That's how Kubernetes comes to the rescue! Kubernetes provides you with a framework to run distributed systems resiliently. It takes care of scaling and failover for your application, provides deployment patterns, and more
Kubernetes provides you with:
Service discovery and load balancing
Storage orchestration Kubernetes
Automated rollouts and rollback
Automatic bin packing.
Secret and configuration management
Self healing
Cgi programming.
CGI is a standard method used to generate dynamic content on web pages. CGI stands for Common Gateway Interface and provides an interface between the HTTP server and programs generating web content. These programs are better known as CGI scripts. They are written in a scripting language. The Network Component provides such a scripting language. The HTTP server processes the script source file line by line and calls the CGI functions as needed. The output from a CGI function is sent to the web client (browser) as a part of the web page.
Each script line starts with a command character which specifies a command for the script interpreter.
Python CGI:
Python provides the CGI module, which helps to debug the script and also support for the uploading files through a HTML form.
So here the question arises what does a Python CGI script output look like? The HTTPs server gives back the output as two sections separated by a blank line. The first section grasps the number of headers, notifying the client what kind of data is following.
Example -
! #usr/bin/python3
print("Content-Type: text/html")
print()
print(“cgi programming “)
In this example in the first line we have to tell which interpreter we are going to use. After that mention the content type in our example it is html. Then write the print() statement to separate thr header and the body part. Our webpage understands through this print statement that instructions has ended now the further content has to be print on the webpage. After that write the code whatever you want to execute.
JavaScript :
JavaScript (js) is a light-weight object-oriented programming language which is used by several websites for scripting the webpages. It is an interpreted, full-fledged programming language that enables dynamic interactivity on websites when applied to an HTML document. It was introduced in the year 1995 for adding programs to the webpages in the Netscape Navigator browser. Since then, it has been adopted by all other graphical web browsers. With JavaScript, users can build modern web applications to interact directly without reloading the page every time. The traditional website uses js to provide several forms of interactivity and simplicity.
Although, JavaScript has no connectivity with Java programming language. The name was suggested and provided in the times when Java was gaining popularity in the market. In addition to web browsers, databases such as CouchDB and MongoDB uses JavaScript as their scripting and query language.
Output of the task:
1.List pods
2.Lauch Pod.
It will ask the user to enter the pod name and image name.
3. List the deployment.
4.Launch the deployment:
It will ask the user to enter the name and the image of the deployment.
5.Scale the deployment:
It will ask the user to enter the name of the deployment to be scaled and also enter the number of replica.
6.Expose the deployment:
It will ask the user to enter the name of the deployment and the port number. Along with these to select the option for the type like NodePort or cluster ip.
7.List the services
8.Delete the deployment:
It will ask the enter to enter the name of the deployment which is to be deleted.
Thank you for reading!!!
