Kubernetes Integration with Python-CGI
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
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.