Latest Article

This tutorial provides you the step by step procedure for installing and configuring kubernetes multinode cluster with Docker on Ubuntu 16.04 LTS using Kubeadm and Kubectl.

In the previous posts, already we have explained the below topics related to Kubernetes. Refer those links to understand this topic from basics.

What is Kubernetes - Learn Kubernetes from Basics
Install & Configure Kubernetes Cluster with Docker on Linux
Create Kubernetes Deployment, Services & Pods Using Kubectl
Create Kubernetes YAML for Deployment, Service & Pods
What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7

install kubernetes on ubuntu

Let's get started.

Our Lab Setup:


kubernetes cluster configuration architecture ubuntu
Prerequisites:
1. Minimum 2 CPU's with 4Gb Memory is required.
2. Make an entry of each host in /etc/hosts file for name resolution on all kubernetes nodes as below or configure it on DNS if you have DNS server.
user1@kubernetes-master:~$ cat /etc/hosts
192.168.2.1 kubernetes-master.learnitguide.net kubernetes-master
192.168.2.2 kubernetes-worker1.learnitguide.net kubernetes-worker1
192.168.2.3 kubernetes-worker2.learnitguide.net kubernetes-worker2
2. Make sure kubernetes master and worker nodes are reachable between each other.
3. Kubernetes doesn't support "Swap". Disable Swap on all nodes using below command and also to make it permanent comment out the swap entry in /etc/fstab file.
sudo swapoff -a
4. Internet must be enabled on all nodes, because required packages for kubernetes cluster will be downloaded from official repository.

Steps involved to create kubernetes cluster,

On All Nodes:
1. Enable Kubernetes repository on master and all worker nodes
2. Install all required packages on master and all worker nodes
3. Start and Enable docker service on master and all worker nodes

On Master Node:
4. Initializing and setting up the kubernetes cluster only on Master node
5. Copy /etc/kubernetes/admin.conf and Change Ownership only on Master node
6. Install Network add-on to enable the communication between the pods only on Master node

On Worker Nodes:
7. Join all worker nodes with kubernetes master node

Before begin, we must update the Ubuntu Repositories and install basic tools like apt-transport-https, curl.
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
Once completed, move on to the next step.

Also You can Watch this Tutorial video on our YouTube Channel.
[youtube src="vTroM0P1G1Q" height="315" width="560" /]

1. Enable Kubernetes repository on master and all worker nodes

Add the Kubernetes signing key on all nodes.
sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Add kubernetes repository on all nodes.
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
2. Install all required packages on master and all worker nodes

Use apt-get command to install kubelet, kubeadm, kubectl, docker.io packages.
sudo apt-get update && sudo apt-get install -y kubelet kubeadm kubectl docker.io
3. Start and Enable docker service on master and all worker nodes
sudo systemctl enable docker
4. Initializing and setting up the kubernetes cluster only on Master node
Use "kubeadm" command to initialize the kubernetes cluster along with "apiserver-advertise-address" and "--pod-network-cidr" options. It is used to specify the IP address for kubernetes cluster communication and range of networks for the pods.
[ads-post]
[user1@kubernetes-master ~]# sudo kubeadm init --apiserver-advertise-address 192.168.2.1 --pod-network-cidr=172.16.0.0/16
Output:
[init] Using Kubernetes version: v1.17.0
[preflight] Running pre-flight checks
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [kubernetes-master kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.2.1]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [kubernetes-master localhost] and IPs [192.168.2.1 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [kubernetes-master localhost] and IPs [192.168.2.1 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
W0113 09:25:59.504686    2708 manifests.go:214] the default kube-apiserver authorization-mode is "Node,RBAC"; using "Node,RBAC"
[control-plane] Creating static Pod manifest for "kube-scheduler"
W0113 09:25:59.506027    2708 manifests.go:214] the default kube-apiserver authorization-mode is "Node,RBAC"; using "Node,RBAC"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[apiclient] All control plane components are healthy after 20.003265 seconds
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.17" in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node kubernetes-master as control-plane by adding the label "node-role.kubernetes.io/master=''"
[mark-control-plane] Marking the node kubernetes-master as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]
[bootstrap-token] Using token: 3vnj3b.vuyqixnigpj9rvfc
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

Your Kubernetes control-plane has initialized successfully!

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

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.2.1:6443 --token 3vnj3b.vuyqixnigpj9rvfc \
    --discovery-token-ca-cert-hash sha256:ee21beeb285a694c88df5defacee97ab50aad3024d9bfab4f9125287899976cc
Kubernetes cluster initialization is completed, Copy the join token highlighted in yellow color from the "kubeadm init" command output and store it somewhere, it is required while joining the worker nodes.

6. Copy /etc/kubernetes/admin.conf and Change Ownership only on Master node
Once kubernetes cluster is initialized, copy "/etc/kubernetes/admin.conf" and change ownership. You could see this same instructions in the output of "kubeadm init" command.
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
7. Install Network add-on to enable the communication between the pods only on Master node
We have lot of network add-on available to enable the network communication  with different functionality, Here I have used flannel network provider. Flannel is an overlay network provider that can be used with Kubernetes. You can refer more add-on from here.
[user1@kubernetes-master ~]# sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Output:
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds-amd64 created
daemonset.apps/kube-flannel-ds-arm64 created
daemonset.apps/kube-flannel-ds-arm created
daemonset.apps/kube-flannel-ds-ppc64le created
daemonset.apps/kube-flannel-ds-s390x created
Use "kubectl get nodes" command to ensure the kubernetes master node status is ready. Wait for few minutes until the status of the kubernetes master turn ready state.
[user1@kubernetes-master ~]# kubectl get nodes
NAME                STATUS    ROLES     AGE       VERSION
kubernetes-master   Ready    master   4m45s   v1.17.0
[root@kubernetes-master ~]#
8. Join all worker nodes with kubernetes master node
Now, Login into all worker nodes and use the join token what you have copied earlier to join all the worker nodes with kubernetes master node as below.
sudo kubeadm join 192.168.2.1:6443 --token 3vnj3b.vuyqixnigpj9rvfc --discovery-token-ca-cert-hash sha256:ee21beeb285a694c88df5defacee97ab50aad3024d9bfab4f9125287899976cc
Output:
W0113 09:31:57.468547   10744 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.17" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
Once worker nodes are joined with kubernetes master, then verify the list of nodes within the kubernetes cluster. Wait for few minutes until the status of the kubernetes nodes turn ready state.
[user1@kubernetes-master ~]# kubectl get nodes
NAME                 STATUS    ROLES     AGE       VERSION
kubernetes-master    Ready    master   7m16s   v1.17.0
kubernetes-worker1   Ready    <none>   91s     v1.17.0
kubernetes-worker2   Ready    <none>   74s     v1.17.0
[root@kubernetes-master ~]#
Thats it, We have successfully configured the kubernetes cluster. Our Kubernetes master and worker nodes are ready to deploy the application. To know how to deploy an applications on kubernetes, go thro

Create Kubernetes Deployment, Services & Pods Using Kubectl
Create Kubernetes YAML for Deployment, Service & Pods

Keep practicing and have fun. Leave your comments if any.

Also refer other articles,

What is Kubernetes - Learn Kubernetes from Basics
Create Kubernetes Deployment, Services & Pods Using Kubectl
Create Kubernetes YAML for Deployment, Service & Pods
What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
How to Run Docker Containers - Explained with Examples

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss
Incoming searches: Kubernetes, Configure Kubernetes Cluster, kubernetes on ubuntu, install kubernetes on ubuntu, install Kubernetes, configure Kubernetes on ubuntu, install Kubernetes cluster, create Kubernetes cluster, setup Kubernetes, Kubernetes cluster install, Kubernetes setup, Kubernetes cluster creation, Kubernetes docker, Kubernetes tutorial, Kubernetes wiki, create Kubernetes using minikube, Kubernetes cluster manually, Kubernetes cluster without minikube, full Kubernetes cluster, Kubernetes cluster architecture, Kubernetes cluster tutorial, Kubernetes cluster wiki, install Kubernetes cluster on linux, install Kubernetes cluster on ubuntu, install Kubernetes cluster on ubuntu 16.04, install Kubernetes cluster on ubuntu linux, install Kubernetes cluster kubeadm, setup kubernetes cluster, multinode kubernetes cluster setup

This post shows you how to access or connect your linux server remotely from windows. SSH is the network protocol works on Port 22 that helps us to take the remote connection over the network either from linux to linux or windows to linux. But anyway linux would be your target server and windows server would be your source server from which you try to connect your target linux server.
So Target Linux server must have running SSH service and also it should allow port 22 in firewall if firewall is running else firewall will block us to take the remote.

How to Access Linux Server from Windows Remotely

By default, SSH Command is available in Linux server, So we can use SSH command directly to take remote from Linux to Linux Machine. But If you want to take remote connection from Windows server to Linux server, You have to install PuTTY on Windows server. PuTTY is available for installation also it is available as a executable file which can be used without installation.

Lets get started.

Step 1: Download PuTTY 

Download the respective 32-bit or 64-bit version based on your server type from this link - https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Direct Link:
32-bit: putty-0.71-installer.msi
64-bit: putty-64bit-0.71-installer.msi

Step 2: Install PuTTY on Windows

Once PuTTY software is downloaded, double click and run the software for installation.

download putty


Click Next.

install putty

Click Next.

putty installation


Click Install.

install putty 64bit setup

Installation will finish quickly. At the final screen, untick "View README file" and Click "Finish".

Step 3: Start Putty Software

[ads-post]

Once installation is completed, Open your installed Putty software from your Programs.

putty ip configuration


Enter the IP Address of your target linux server you wish to connect from windows machine over the network. Make sure port number "22" and connection type "SSH" are specified in the box. Click "Open".

putty linux login screen

If everything is ok, you will be asked to enter the correct username and password. Provide your details and start accessing your linux server remotely from windows server.

Hope this post helps you to access linux server from windows remotely by installing putty software.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss
Incoming Searches : accessing linux server, access linux server from windows, connect linux server, connecting linux server from windows, connect linux remotely, access linux remotely from windows, linux remote server, putty for windows, connect linux server using putty, download putty, install putty on windows, download putty for windows, access linux remotely

This post gives you an set of Ansible Playbook that would help you to build a Complete Multinode Kubernetes Cluster in an automated way to deploy an containerized application. In the previous post, we have given you the step by step procedure to install and configure kubernetes cluster manually on linux servers using kubeadm and kubectl commands.

You can also refer these below mentioned related links to understand this topic from basics.
What is Kubernetes - Learn Kubernetes from Basics
Create Kubernetes Deployment, Services & Pods Using Kubectl
Create Kubernetes YAML for Deployment, Service & Pods
What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
How to Run Docker Containers - Explained with Examples

These playbooks will work on any physical servers, virtual machines, aws cloud, google cloud or any other cloud servers. This has been tested and verified on Centos 7.3 64 bit operating systems.



Let's get started.
kubernetes cluster configuration

We have created these ansible playbooks and stored in our github repository.

List of Files Available in this repository

ansible.cfg - Ansible configuration file created locally.
hosts - Ansible Inventory File
env_variables - Main environment variable file where we have to specify based on our environment.
settingup_kubernetes_cluster.yml - Ansible Playbook to perform prerequisites ready, setting up nodes, configure master node.
configure_worker_nodes.yml - Ansible Playbook to join worker nodes with master node.
clear_k8s_setup.yml - Delete entire configurations from all nodes.
playbooks - Its a directory holds all playbooks.

How to use this ansible playbooks: (Setup Instructions)

Also You can Watch this Tutorial video on our YouTube Channel.
[youtube src="kMKkpgB6IwM" height="315" width="560" /]


Once your servers are ready (one master node and multiple worker nodes), follow these below instructions.

1. Make an entry of your each hosts in /etc/hosts file for name resolution.
cat /etc/hosts
192.168.2.1 kubernetes-master.learnitguide.net kubernetes-master
192.168.2.2 kubernetes-worker1.learnitguide.net kubernetes-worker1
192.168.2.3 kubernetes-worker2.learnitguide.net kubernetes-worker2
2. Make sure kubernetes master node and other worker nodes are reachable between each other.

3. Internet connection must be enabled in all nodes, required packages will be downloaded from kubernetes official yum repository.

4. Clone this repository into your master node.
git clone https://github.com/learnitguide/kubernetes-and-ansible.git
once it is cloned, get into the directory.
cd kubernetes-and-ansible/centos
5. Edit a file "hosts" available in "centos" directory, Just make your entries of your all kubernetes nodes along with respective ip address.

Master Node Entries
[kubernetes-master-nodes]
kubernetes-master.learnitguide.net ansible_host=192.168.2.1
Worker Node Entries
[kubernetes-worker-nodes]
kubernetes-worker1.learnitguide.net ansible_host=192.168.2.2
kubernetes-worker2.learnitguide.net ansible_host=192.168.2.3
6. Edit a file "env_variables" available in "centos" directory and provide your server details like advertise address ip and cidr range values. Dont edit any other values in this file.
ad_addr: 192.168.2.1
cidr_v: 172.16.0.0/16
7. Deploy the ssh key from master node to other nodes for password less authentication to run ansible playbooks. Generate a SSH Key pair using ssh-keygen as below.
ssh-keygen
Enter the required values or just hit enter to take the default values. Copy the public key to all nodes including your master node and make sure you are able to login into any nodes without password. Refer this link to know How to configure SSH Passwordless Login Authentication (SSH-keygen)

8. Setting up Kubernetes Cluster Nodes using Ansible Playbook.
There is a playbook called "settingup_kubernetes_cluster.yml" to setup all nodes and kubernetes master configuration. Just run this playbook using ansible-playbook command first.
ansible-playbook settingup_kubernetes_cluster.yml
9. Joining Worker Nodes
Run "join_kubernetes_workers_nodes.yml" playbook to join the worker nodes with kubernetes master node once "settingup_kubernetes_cluster.yml" playbook tasks are completed.
ansible-playbook join_kubernetes_workers_nodes.yml
Verify the configuration from master node.
kubectl get nodes
That's it, we have successfully configured our kubernetes cluster setup using ansible playbook. you can now try deploying some applications to make sure everything is working fine.
Refer these links to Create Kubernetes Deployment, Services & Pods Using Kubectl and Create Kubernetes YAML for Deployment, Service & Pods

You can also refer these below mentioned related links to understand this topic from basics.
What is Kubernetes - Learn Kubernetes from Basics
What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
How to Run Docker Containers - Explained with Examples

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss 
kubernetes, kubernetes ansible, kubernetes ansible playbooks, kubernets using ansible, install kubernetes with ansible, ansible playbook, deploy kubernetes using ansible, kubernetes ansible deployment, setup kubernets using ansible, install kubernetes cluster using ansible

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget