Home Kubernetes Cluster Management
Post
Cancel

Kubernetes Cluster Management

In this article, I would like to use the ‘director’ virtual machine that we created at the end of the Xen Orchestra – Add Ubuntu Server VM’s article and have this machine manage our Kubernetes Cluster and be able to install packages using Helm.

<< Previous Kubernetes Cluster

In order for this machine to manage our cluster, we will need to first install kubectl (without a Kubernetes install) and then also install Helm. Let’s get started.

Install kubectl

On our ‘Director’ VM, start the kubectl installation. First, the following lines will update the apt package index and install packages needed to use the Kubernetes apt repository.

1
2
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl

After that, download the Google Cloud public signing key.

1
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

Add the Kubernetes apt repository.

1
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

And the last install step, update apt package index with the new repository and install kubectl.

1
2
sudo apt-get update
sudo apt-get install -y kubectl

kubectl Configuration

See The Cluster

If we try to run the command “kubectl cluster-info”, we will see an error message and not our cluster info.

1
The connection to the server <server-name:port> was refused - did you specify the right host or port?

We need to tell our ‘Director’ VM where our Kubernetes Cluster is. In order to do this we need a Kubernetes config file.

We will grab this config file from our Control Plane VM that we created in the Kubernetes Cluster article and copy that to our Director VM.

First, create a director in your user’s home directory named “.kube”. This will be a hidden directory. In my case, the username on my Director VM is “ericsmasal”, so my command would look like: “sudo mkdir /home/ericsmasal/.kube”.

1
mkdir /home/<username>/.kube

Now, I use MobaXterm to ssh into my machines. You can do the same process with your ssh tool or you may have to ftp the file to your machine.

Here, I located the config file on my Control Plane and I will download it to my local machine.

Alt text

Then I just dragged and copied the config file to the same directory that we just created back on our Director VM.

Now if you run the command:

1
kubectl cluster-info

You should now see something that looks like:

Alt text

Install Helm

Next we will install helm to make packages easier to install to our cluster and cut some overhead.

Install Helm with these commands

1
2
3
4
5
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
sudo apt-get install apt-transport-https --yes
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm

After installation is complete, I check to make sure it installed correctly by running “helm version” and you should get some proper version information back.

In the next post, I would like to use Helm on our Director VM and install MetalLB and the Nginx Ingress Controller to our Cluster. The Ingress controller will allow us nice and neat local IP addresses to access our resources in our cluster. Usually Ingress Controllers are part of a cloud offering in AWS or Azure (for example). Because we are running our Cluster locally, we need to use the MetalLB to help server out our IP addresses. It won’t be too bad installing these with Helm.

>> Next Nginx Ingress load balancer and MetalLB

Hope to see you then!

This post is licensed under CC BY 4.0 by the author.