top of page
Writer's pictureSathish Kumar

Test drive and install Kubernetes

Updated: Jan 15, 2021


Kubernetes runs on almost all popular operating systems. Then there are options, that allow you to try Kubernetes without having to install it. Let's explore some of the options.


If you want to test drive Kubernetes, you can do so through the browser itself. Kubernetes playground by Katakoda is a good option. You can find it here



Note: Katacoda was acquired by Oreiley in Nov-2019. Announcement here

Another web-based option is play-with-K8's:



If you are using Docker Desktop on Windows, you can enable Kubernetes just by checking it in settings:




If you want to run Kubernetes in VM to try to things, you can install Minikube



Finally, If you want to get your hands dirty you can install Kubernetes on Ubuntu servers and set up a proper cluster. The Ubuntu servers could be physical servers or VMs.



Note: Main difference between installing Minikube and installing Kubernetes in VM is- Minikube allows you to emulate a Kubernetes cluster "within" a single VM. Installing Kubernetes in separate VMs and creating a cluster is much closer to real-world deployments.

I have 2 Ubunutu server VM's with Docker installed. I am going to install Kubernetes on this



Note: For installing Docker for Kubernetes, refer steps given here


1. Add the signing key

root@sathish-vm1:/home/sathish# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add

2. Add Kubernetes repository

root@sathish-vm1:/home/sathish# apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"

3. Install the packages

root@sathish-vm1:/home/sathish#apt-get install kubeadm kubelet kubectl
root@sathish-vm1:/home/sathish# apt-mark hold kubeadm kubelet kubectl

4. Disable Swapspace on servers/VM(s) where you installed Kubernetes. If this step is missed you will not be able to start Kubernetes and you will get an error "[ERROR Swap]: running with swap on is not supported. Please disable swap"


root@sathish-vm1:/home/sathish# swapoff -a

5. Initialize the cluster on the Master node.



kubeadm init --pod-network-cidr=192.168.0.0/16

This will give the cluster join URL. Copy this as you need to paste it on worker nodes.

"kubeadm join 192.168.29.86:6443 --token eu2m6u.7i3uz0ac8kvaxbtu \ --discovery-token-ca-cert-hash sha256:9ff09c537533a711528782f922bf14f260680a965bf61fcd641c0760e63e1b32"


6. Create directories for clusters on the master node.


root@sathish-vm1:/home/sathish# mkdir -p $HOME/.kube
root@sathish-vm1:/home/sathish#cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
root@sathish-vm1:/home/sathish#chown $(id -u):$(id -g) $HOME/.kube/config

7. Verify client and server versions on the master node. If the client and server versions match and you do not get an error this means the install is successful.



Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:30:33Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:23:04Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}

In the next article, I will describe some basic Kubernetes concepts like Pods, services. I will then show you how to create an httpd service that runs replicas on nodes across the Kubernetes cluster.


That's it for today folks. Thanks for all your comments and feedback, they really help :) Keep them coming by visiting https://www.sysspace.net/about and submitting the "Contact Author" form.



59 views0 comments

Comments


bottom of page