Integrate Kubernetes commands that can be run through web UI

In today's blog, we are creating a web-based terminal to run the commands with the help of javascript and python as backend.

What is Javascript?

JavaScript is a text-based programming language used both on the client-side and server-side that allows you to make web pages interactive. Where HTML and CSS are languages that give structure and style to web pages, JavaScript gives web pages interactive elements that engage a user.

The program on the remote server sends information to the client (i.e. the user's machine) and the software on the client-side reads the information and renders output on the screen. Where does python fit into this?

The program on a remote server that I talked about just above is where python comes into the picture. So the client will input the command into the web page and then the program at the backend which is written in python will get the request and process it and give back the response to the front-end which will then be shown to the user. Our Setup

So for this demo I have used Linux as my VM and in it, I have installed an apache webserver and python code to handle and process the requests and in the front end, I have used basic HTML, CSS, and Javascript to send requests and show response. Let's Start

First, let's take a look at our front-end part. Here's what it looks like.

HTML

image.png

CSS

image.png

Javascript

image.png

Here's how it looks like on running.

image.png

image.png

Now let's see our backend. As I already told I have installed apache as a web server and I have it up and running already. Here's my python program.

image.png

Now our setup is complete and what is left is for us to test the setup now. Here's what happens when I run the commands.

image.png

image.png

And here you can it has launched successfully.

image.png