Kubernetes Integration with Python-CGI

What is Kubernetes?

Kubernetes is a Greek for pilots or helmsman(the person holding the sjip’s steering wheel). Kubernetes abstracts away the hardaware infrastructure and expose your whole datacenter as a single enormous computational resources. It allows you to deploy and run your software components without having to know about the actual servers underneath.When deploying a multi- component application through kubernetes, it selets a server for each component. deploys it and enables it to easily find and communicate with all the other componenets of your application.

Development and deployment of application has changed in the reent years, This change is both a consequence of splitting big monolithic apps into smaller microservices and of the changes in the infrastructre that runs those apps.

We will be Creating a web UI page as such that using normal English conversation your all commands can run in background.
Example — when we write ‘run deployment using httpd image’ then it run complete deployment command in backend.

Necessary Feature-
👉# 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.
👉#Extra features related to k8s ( Optional)
Note — There should be webUI based menu display so that user can get to know what your webapp can do.

This app will help the user to run all the Kubernetes commands:

In computing, Common Gateway Interface (CGI) is an interface that enables web servers to execute an external program(python program), typically to process user requests. Such programs are often written in a scripting language and are commonly referred to as CGI scripts, but they may include compiled programs.

When weare CGI, we don’t need to store HTML pages on a server, but can be dynamically created as and when a user makes a website query.

httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.

Before running the server we need to install it in the OS(I am using RHEL 8)

Turn on the HTTP server

Your server is now live.

Now A CGI-bin is a folder used to house scripts that will interact with a Web browser to provide functionality for a Web page or website.

This is the default path generated of cgi-bin after installation of httpd. In this folder I have created a python folder docker.py and made executable , That’s the reason it showing in green colour font.

chmod +x on a file (your script) only means, that you’ll make it executable

Contents of Kube.py

/var/www/html is just the default root folder of the apache web server. You can change that to be whatever folder you want by editing your apache.conf file (usually located in /etc/apache/conf) and changing the DocumentRoot attribute (see http://httpd.apache.org/docs/current/mod/core.html#documentroot for info on that)

/var/www/html being the folder you want to install your website on

Now turn off your system firewall (Terminal commands)

Now restart your server (Terminal commands)

To allow access to webserver (termainal)

INSIDE /etc/sudoers add this line to allow access to webserver(vim editor)

After All this you are good to go and run Kubernetes commands on your Website.

— — — — — — — — — Thankyou for reading, Do share ❤ — — — — — — — —



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