Kubernetes Integration with Python-CGI.
Task Description: Create a WebUI page for kubernetes
Feature necessary.
⚙ It can launch pods with the specific names given by users.
⚙ Run deployment using the image and name given by the user.
⚙ Expose services on given user input port number.
⚙ Scale the replica according to user needs.
⚙ Delete complete environment created.
⚙ Delete specific resources given by the user.
⚙ Extra features related to k8s ( Optional)


Pre-requisite:
✔ Minikube must be Configured
To install the Minikube check this Document
✔Setup Kubernetes and admin.conf file
To Setup Kubernetes follow this link
Step-1: Installing the Kubectl on Virtual Box:
♦Creating a Kubernetes.repo directly to install Kubectl
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF
♦Installing Kubectl using yum
yum install -y kubectl --disableexcludes=kubernetes
Step-2: Stopping Firewall and Stuff…
systemctl stop firewalldsetenforce 0
Step-3: Setting up the Front-End.
♦Go to “/var/www/html” and create a file named Index.html
Step-3: Setting up the Back-End.
♦Go to “/var/www/cgi-bin” and create a file named dockerps.py
#!/usr/bin/python3
import cgi
import subprocess
import time
print(“content-type: text/html”)
print()
k = cgi.FieldStorage()
cmd = k.getvalue(“x”)
o = subprocess.getoutput(cmd)
print(o
Step-4: Now transferring the “admin.conf” file to “var/www/cgi-bin”.

Step-5: Finally using browser and accessing the site.
