Nowadays,Organization are adapting the cloud native apps(Web apps) for production because of

  • Deployment friendly
  • Fast delivery
  • Self healing
  • Maintenance easy and lot more.

Docker and Kubernetes open source plays a vital role in developing Cloud native apps.Proven publicly available apps are running stable.From my perspective deploying in the hypervisor will lot more stability.When comes with VMware vSphere HA and DRS leverage the high SLA to customer.

In home lab,I’ve deployed in three different flavour first bare installation, VMware Photon OS and last lxd with JuJu.

Bare OS Installation on Ubuntu

In Master:

sudo apt-get update

sudo apt-get install docker.io (or docker-ce)

sudo systemctl enable docker

sudo apt-get install curl

Curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add

sudo apt-add-repository “deb http://apt.kubernetes.io/ kubernetes-xenial main

sudo swapoff -a

sudo apt-get install kubeadm -y

sudo kubeadm init –pod-network-cidr=192.168.0.0/16 –apiserver-advertise-address=192.168.1.10

At this point you will get the some details need to noted it down which needs to run nodes.

sudo kubeadm token list

openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed ‘s/^.* //’

mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

Flannel Virtual network that gives a subnet to each host for use with container.

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

Kubernetes Dashboard

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

kubectl get pods –all-namespaces

To view the dashboard from network domain

sudo kubectl proxy –address=192.168.1.10

kubectl -n kube-system edit service kubernetes-dashboard

You need to change to nodePort

Refer : https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard—1.7.X-and-above

Using below command you will get the TCP port to access the dashboard

kubectl -n kube-system get service kubernetes-dashboard

Create a service account to login into dashboard

kubectl create serviceaccount dashboard -n default

Refer : https://github.com/kubernetes/dashboard/wiki/Creating-sample-user

kubectl create clusterrolebinding dashboard-admin -n default –clusterrole=cluster-admin –serviceaccount=default:dashboard

Get the secret key to get the login to kubernetes dashboard using token

kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath=”{.secrets[0].name}”) -o jsonpath=”{.data.token}” | base64 –decode

In Kubernetes Nodes

Install docker

sudo apt-get install docker.io (or docker-ce) -y

sudo apt-get install curl

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add

sudo apt-add-repository “deb http://apt.kubernetes.io/ kubernetes-xenial main”

sudo swapoff -a

sudo apt-get install kubeadm -y

You will get this command will installing the kubernetes Master make sure you are make a note of it.

kubeadm join 192.168.1.10:6443 –token vuq4y5.joc5hercja80y3zs –discovery-token-ca-cert-hash sha256:f80ba499aab83ff182f8f03d366657e08f3536b260cdcd47ffc969986634f57d

Photon OS

tdnf install docker
tdnf install kubernetes
systemctl enable docker

Three liner deployment in photon OS.

Refer : https://github.com/vmware/photon/blob/master/docs/kubernetes.md

Kubernetes Deployment wih lxd and conjure-up

OS:Ubuntu DISTRIB_RELEASE=18.04

sudo apt remove lxd lxd-client
sudo snap install lxd
sudo snap install conjure-up –classic –edge

Go with edge deployment in conjure-up since all the bug fix is available in this version.

dee@juju:~$ sudo lxc profile show default
config: {}
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
root:
path: /
pool: default
type: disk
name: default

Note:while initialize the lxd you need to use the following information 1.use dir as a file system 2.disable ipv6 by saying none.make sure you have enough space in / with minimum of 50 GB and /home 10GB.

conjue-up kubernetes
-Canonical distribution of Kubernetes
-Canonical distribution of Kubernetes with nvidia GPU workers
-Kubernetes Core
-minikube

upon required selection,you can get status using below mention command.

lin1

Obtain a stats with below mention command

lin2

Note:it might take several minutes to build,so have your coffee break and watch it

lin4.JPG

 

To Follow:

https://kubernetes.io/blog/

https://videos.vmworld.com/searchsite/2018/videoplayer/18528

https://github.com/kelseyhightower/kubernetes-the-hard-way%5Bupdate SEP 9th 2018]

Kubernetes Logo used with permission under the Kubernetes Branding Guidelines

Advertisements