Kubernetes Integration with Python-CGI

Ayush Bhat
2 min readJul 1, 2021

--

Source Internet

Task Description πŸ“„
πŸ‘‰ Create webUI 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.

Feature necessary -
πŸ‘‰ 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.
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:

After completing this basic setup you will be able to add extra features to it and can make it more dynamic.

Technologies Involved in this task :

1. JavaScript

2. CSS

3. Python

4. Kubernetes

HTML CSS JS source Internet
Source Internet

Combining all these technology is a great combo.

Kubernetes is highly efficient in Production environment.

CGI Program that I used as backend

HTML/CSS/JS code for the hosted page

<script>
function lw() {
var i = document.getElementById("input").valuevar xhr = new XMLHttpRequest();xhr.open("GET", "http://192.168.29.163/cgi-bin/cgi-k8s.py?x=" + i, true);
xhr.send();
xhr.onload = function() {
var output = xhr.responseText;
document.getElementById("d2").innerHTML = output;
}
}
</script>
<style>
.someclass {
width: 600px;
}
</style>
[root@localhost]#<input id="input" class="someclass"/>
<button onclick="lw()">click</button>
<pre>
<div id="d2">Output</div>
</pre>

Our Web Page will look like this

U can customize it as per your requirements.

GitHub Link for the repo

That’s all for now. Thanks for reading.

--

--

Ayush Bhat
Ayush Bhat

Written by Ayush Bhat

AWS SAA-C02 | Certified Kubernetes Administrator | Linux Foundation Certified Sysadmin | Ex294 RedHat Certified Engineer

No responses yet