Kubernetes Web Portal using JS & Py-CGI

In my Docker Web Portal, I took input from the user via key:value pair. In this web app, I have used a smarter approach. Here you can write/speak English statements and the Python CGI Code will understand the statement & convert it into commands and present the commands & their output on the web app.

Daksh Jain
2 min readJul 6, 2021

Frontend ➡

  • HTML
  • CSS
  • JavaScript

Backend ➡

  • Python CGI
  • Kubernetes

Using Python CGI Codes I am taking input from the client (via the web portal) in the form of English Statements & the code runs the particular kubectl commands and gives the output back to JS functions that display it on the webpage.

The Website

Features of the Website:

  • Display all pods, deployment, service
  • Create pods, deployment, services
  • Expose deployments
  • Scale the deployment
  • Delete particular/all resources

Pre-requisites to run the web app

  • Create appropriate firewall rules & SELinux rules, or for simplicity switch it off.
  • Setup the Apache webserver for the codes to run.
  • Install kubectl command line and configure the kubectl to use either a local minikube cluster or a cloud-based cluster.
  • Then you need the configuration files, keys & certificates in the proper folder and kubeconfig path properly set, to use the kubectl command line.
# kubectl version
  • Using this command check whether you can connect to the server.

After this, using simple if…else conditions, I am converting the English statements into the proper kubectl commands that will be run on the background by the CGI codes.

A screenshot of how the code is basically working

For the complete action you can refer to the video below :

This project is done along with Khushi Thareja.
Do comment and share it if you like. 😃

I am always open to suggestions & available for fun projects as well !!

Connect with me over LinkedIn :)
Follow me on Medium
Check out my Github!

This Repo — JS-K8S-Web_portal

--

--

Daksh Jain
Daksh Jain

Written by Daksh Jain

Automation Tech Enthusiast || Terraform Researcher || DevOps || MLOps ||

No responses yet