Kubernetes Integration with Python-CGI.

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.

--

--

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
Rishabh

Rishabh

Student from B.tech 2nd Year, A proud ARTH learner, love new technologies, Curious about many thing, likes to explore places, love eating pizza and much more.