How to Deploy an Express Kubernetes Cluster with Ansible

Prerequisites

  • Ansible server

IP address: 172.xx.xx.xx

  • Express Kubernetes Cluster server

OS: Ubuntu 16.04 LTS or CentOS 7

Disk: 120 GB SSD + 960 GB SSD + 2TB SATA

Internet access is available for the server to download software binaries

Password-less SSH has to be enabled for the root user on the server

Preparing Express Kubernetes Cluster Server

Set up disks

1.Create disk mount directory

mkdir /data

mkdir /backup

2.Get disks information

how-to-deploy-an-express-kubernetes-cluster-with-ansible

3.Create disk partitions /dev/sdb and /dev/sdc

how-to-deploy-an-express-kubernetes-cluster-with-ansible
how-to-deploy-an-express-kubernetes-cluster-with-ansible

4.Check the new disk partitions

fdisk -l

how-to-deploy-an-express-kubernetes-cluster-with-ansible

5.Formatting the new partitions

how-to-deploy-an-express-kubernetes-cluster-with-ansible
how-to-deploy-an-express-kubernetes-cluster-with-ansible

6.Mount the new partitions

how-to-deploy-an-express-kubernetes-cluster-with-ansible

7.Check the file system information

how-to-deploy-an-express-kubernetes-cluster-with-ansible

8.Set up the new partition mount automatically

vi /etc/fstab

how-to-deploy-an-express-kubernetes-cluster-with-ansible

Install Python2.7 and enable root user

For Ubuntu 16:

1.Install python2.7


kuber$ sudo apt update
kuber$ sudo apt install python2.7 -y
kuber$ sudo ln -s /usr/bin/python2.7 /usr/bin/python  

2.Enable root user


kuber$ sudo passwd root
kuber$ sudo sed -i 's/prohibit-password/yes/' /etc/ssh/sshd_config
kuber$ sudo service ssh restart

For Centos 7:

1.Install python2.7


root# yum install epel-release -y
root# yum update -y
root# yum install python -y

2.In Centos7, the root user has been enabled by default.

Preparing Ansible server and deploying Express Kubernetes Cluster

Log in to Ansible server

IP address: 172.*

Username: administrator

Password: Da*

Enable password-less SSH

Copy the public key from Ansible server to Express Kubernetes Cluster server.


root# ssh-copy-id 198.*

Modify the Ansible inventory file

vi /deploy/kubeclusters/express/hosts

how-to-deploy-an-express-kubernetes-cluster-with-ansible

You just need to change the Express Kubernetes Cluster servers’ IP.

Deploy the Kubernetes cluster


root# cd /deploy/kubeclusters/express
root# ansible-playbook deploy.yml

Verifying Installation

On Express Kubernetes Cluster server, run ‘kubectl version’ in the console to view the version of Kubernetes.

how-to-deploy-an-express-kubernetes-cluster-with-ansible

On Express Kubernetes Cluster server, run ‘kubectl get componentstatus’ in the console to check the status of Kubernetes components.

how-to-deploy-an-express-kubernetes-cluster-with-ansible

Run ‘kubectl get node’ to view the node status.

how-to-deploy-an-express-kubernetes-cluster-with-ansible

Run ‘kubectl get pod --all-namespaces’ to get the status of all pods.

how-to-deploy-an-express-kubernetes-cluster-with-ansible

Verifying in Kubernetes dashboard

Open https://198.x.x.x:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy in your browser and select Token option

how-to-deploy-an-express-kubernetes-cluster-with-ansible

The Dashboard token can be retrieved by running the following command


root# Dashboard_Secret=`kubectl get secret -n kube-system|grep kubernetes-dashboard-token|awk '{print $1}'`
root# kubectl describe secret -n kube-system ${Dashboard_Secret} |sed -n '$p'|awk '{print $NF}'

how-to-deploy-an-express-kubernetes-cluster-with-ansible
how-to-deploy-an-express-kubernetes-cluster-with-ansible

Verifying in Grafana

Open http://198.X.X.X:30002

how-to-deploy-an-express-kubernetes-cluster-with-ansible

Username: admin

Password: admin

how-to-deploy-an-express-kubernetes-cluster-with-ansible

Getting Express Kubernetes Cluster info


root# cd /deploy/kubeclusters/express
root# sh get_k8s_info.sh

how-to-deploy-an-express-kubernetes-cluster-with-ansible

1 Master/Node Server
CPUs : E5-2670
RAM : 128GB
Disks : 240GB SSD + 2*960GB SSD + 2TB SATA
$179.00 / Month

More Details

8 Bare-Metal Servers
Master Servers : 3
CPU : E3-1230
RAM : 16GB
High Availability :
Node Servers : 5
CPUs : E5-2670
RAM : 128GB
Disks : 240GB SSD + 2*960GB SSD + 2TB SATA
$1229.00 / Month

More Details

We use cookies to help optimize the website and give you the best experience. Privacy Policy