Uncategorized

K8s Cluster

In my life from one day to another I’m looking for a new and interesting technologies which I can build test and learn. Now is the time to test the kubernetes cluster. K8s because this is called by some is not some new discovery, however, finds more and more recognition among various sysadmin / cloud solutions

So let’s start

Manual

Manual deployment of K8s cluster is not so hard. We need 3 VM which has at least 2vCPU. In my lab I’ve namedthem

and I’ve created correct DNS records in AD

on all VM I’ve also checked communication between

our VM required some preparation

1. systemctl stop firewalld
2. systemctl disable firewalld

3. swapoff -a
4. sed -i.bak -r ‘s/(.+ swap .+)/#\1/’ /etc/fstab

5. setenforce 0
6. sed -i ‘s/^SELINUX=enforcing$/SELINUX=permissive/’ /etc/selinux/config

7. wget http://192.168.100.135/kubernetes.repo -P /etc/yum.repos.d/

8. yum install -y docker kubelet kubeadm kubectl

9. systemctl enable docker; systemctl start docker
10. systemctl enable kubelet; systemctl start kubelet

As this is Lab environment I turn off the firewall instead of setting the rules. K8s required that SWAP is turned off so line 3 and 4 describing this

Line number 7 provide repofile from my Repository server with that data

[kubernetes]
 name=Kubernetes
 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
 enabled=1
 gpgcheck=1
 repo_gpgcheck=1
 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

when all dependencies are completed we can start with instalation/configuration kubernetes

To run this we need to initiate command kubeadm init

This take a while with information what happen in specific time

at the end we are getting which command we should run next and which we need to run on our node machine

To start using your cluster, you need to run the following as a regular user:
 mkdir -p $HOME/.kube
 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
 sudo chown $(id -u):$(id -g) $HOME/.kube/config

As we can observed to run cluster with other node we need to deploy pod network. There are many posibilities but I will not describe all and only show one of them

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

after that we only need run one command on nodes

kubeadm join 192.168.100.136:6443 --token laupzd.przrnwfmcdklo5ib --discovery-token-ca-cert-hash sha256:d0f02a25186fc5e97d30578ada6db58d56d97139fc5a083d8190f2e5018cfddd

and our cluster is ready to use

As you can see this is not dificult so maybe we can put this in vRA ??? maybe next…

Share with:


Leave a Reply

Your email address will not be published. Required fields are marked *