top of page

How to deploy KubeSphere, Kubernetes Cluster Management Web UI

Updated: Jun 22, 2023

KubeSphere offers a user-friendly web-based UI for managing your Kubernetes cluster, and even offers CI/CD tools like Jenkins and provides automated building of container images from source code.

How to deploy KubeSphere, Kubernetes Cluster Management Web UI

If you’re looking for a Kubernetes platform that is tailored for hybrid multicloud, KubeSphere might be just the tool you need.

KubeSphere can help with full-stack, automated IT operations and even streamline your DevOps workflows with a developer-friendly web UI. KubeSphere offers a plug-and-play platform and allows seamless integration of third-party applications.

Most importantly, KubeSphere offers a user-friendly web-based UI for managing your Kubernetes cluster, and even offers CI/CD tools like Jenkins and provides automated building of container images from source code.

KubeSphere is powerful but not exactly easy to deploy. Let me see if I can help you out with that process.

What You’ll Need

I’m going to demonstrate with Ubuntu Server 22.04. You’ll need three instances, one for the master and two for nodes. You’ll also need a user (on each machine) with sudo privileges.

That’s it. Let’s get to work…

Configure Your Servers

With your three servers up and running, there are some configuration steps you need to take on each. The first is to set the hostnames. We’ll call them:

  • kubesphere1

  • kubesphere2

  • kubesphere3

For the purpose of this article, the IP addresses associated with each will be:

  • kubesphere1 – 192.168.1.40

  • kubesphere2 – 192.168.1.41

  • kubesphere3 – 192.168.1.41

Make sure to change the IP address to meet your needs.

Log into your first server and set the hostname with:

sudo hostnamectl set-hostname kubesphere1

Log into the next server and set the hostname with:

sudo hostnamectl set-hostname kubesphere2

Finally, log into the third server and set the hostname with:

sudo hostnamectl set-hostname kubesphere3

Next, we need to configure the hosts file. On all three machines, open the file for editing with the command:

sudo nano /etc/hosts

At the bottom of those files, paste the following (adjusting for your IP address scheme):

192.168.1.40 kubesphere1
192.168.1.41 kubesphere2
192.168.1.42 kubesphere3

Save and close the file.


Now, we need to create a new user on each machine. We’ll call that user ubuntu. Remember, this has to be done on all three machines. The command for this is:

sudo useradd -m -s /bin/bash ubuntu

Next, create a password for the user with:

sudo passwd ubuntu

Make sure to give the user a strong/unique password.


We now have to allow the new user (on all three machines) to execute sudo commands without a password. To do that, issue the following command on each server:

cat <<EOF | sudo tee /etc/sudoers.d/ubuntu
Defaults:ubuntu !fqdn
Defaults:ubuntu !requiretty
ubuntu ALL=(ALL) NOPASSWD: ALL
EOF

SSH Key Authentication

We’ll now set up SSH authentication. On the master node (kubesphere1) change to the new ubuntu user with the command:

su - ubuntu

Create the new key with the command:

ssh-keygen -t ed25519

It’s important to make sure to not set a password for this key. So, when prompted for a password, just hit Enter on your keyboard.

Once the key is generated, you must copy it to all three servers with the commands:

ssh-copy-id ubuntu@kubesphere1
ssh-copy-id ubuntu@kubesphere2
ssh-copy-id ubuntu@kubesphere3

You will be prompted for the ubuntu user password each time.

Install the Necessary Dependencies

We now must install the necessary dependencies on all three servers. On all three servers, issue the command:

sudo apt install curl socat conntrack ebtables ipset -y

Download the KubeKey Binary

This is done only on the master server. Download the KubeKey binary file with the command:

curl-sfL https://get-kk.kubesphere.io | VERSION=v3.0.2 sh -

Give that file executable permission with:

chmod +x kk

Generate the Required Configuration

Next, we must generate a configuration file on the master server with the command:

./kk create config -f deployment-kubesphre.yml --with-kubernetes v1.24.2 --with-kubesphere v3.3.1

Once the configuration file is generated, open it for editing with the command:

nano deployment-kubesphre.yml

You must edit this file so that the hosts section looks like this:

hosts:
- {name: kubesphere1, address: 192.168.1.40, internalAddress: 192.168.1.40, user: ubuntu, privateKeyPath: "~/.ssh/id_ed25519"}
- {name: kubesphere2, address: 192.168.1.41, internalAddress: 192.168.1.41, user: ubuntu, privateKeyPath: "~/.ssh/id_ed25519"}"
- {name: kubesphere3, address: 192.168.1.42, internalAddress: 192.168.1.42, user: ubuntu, privateKeyPath: "~/.ssh/id_ed25519"}
roleGroups:
etcd:
- kubesphere1
control-plane:
- kubesphere1
worker:
- kubesphere2
- kubesphere3

Make sure to edit the IP addresses to conform to your scheme.

Save and close the file.

Deploy Everything

We now need to deploy both Kubernetes and KubeSphere, which is done with a single command:

/kk create cluster -f deployment-kubesphre.yml

This will take anywhere from 10-30 minutes to complete (depending on the speed of your network connection and servers). During the initial run, you’ll be prompted to OK the installation, so type yes and hit Enter on your keyboard.

At the end of this lengthy process, you’ll be presented with the address to access KubeSphere, along with the default admin credentials. You can then open a web browser to the indicated address and log in with the supplied credentials (Figure 1).

Figure 1: The KubeSphere login window. - How to deploy KubeSphere, Kubernetes Cluster Management Web UI
Figure 1: The KubeSphere login window.

You’ll be prompted to immediately change the admin password. Once you do that, you’ll find yourself on the KubeSphere dashboard, where you can start working with your cluster (Figure 2).

Figure 2: The KubeSphere management platform is ready to go. - How to deploy KubeSphere, Kubernetes Cluster Management Web UI
Figure 2: The KubeSphere management platform is ready to go.

Click Platform in the upper left corner and then click Cluster Management, to reveal the management dashboard (Figure 3).

Figure 3: The KubeSphere cluster management dashboard.- How to deploy KubeSphere, Kubernetes Cluster Management Web UI
Figure 3: The KubeSphere cluster management dashboard.

Congratulations, you now have a very powerful Kubernetes management platform that can help you take control of your cluster and deployments.


67 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
Stationary photo

Be the first to know

Subscribe to our newsletter to receive news and updates.

Thanks for submitting!

Follow us
bottom of page