Installing Kubernetes on Centos 7/RHEL7 with kubeadm
Overview
Kubeadm is utility which is currently is in alpha which provides kubernetes very easily.
Prerequisites
1. One or more physical and virtual machines running CentOS 7 or RHEL 7.
2. 1GB or more of RAM per machine .
3. Network connectivity between machines in the cluster.
4. Good internet connectivity.
2. 1GB or more of RAM per machine .
3. Network connectivity between machines in the cluster.
4. Good internet connectivity.
Installation Steps:
Kindly follow below steps on on every nodes.
#setenforce 0
1. Set system hostname:
(You can change hostname according to you nodes.)
1.# hostnamectl set-hostname node10.dockerhunt.com2. Install and activate iptables and disbale firewalld (as kubernetes and docker uses iptables.)
01.# yum install iptables-services.x86_64 -y02.# systemctl stop firewalld.service03.# systemctl disable firewalld.service04.# systemctl mask firewalld.service05.# systemctl start iptables06.# systemctl enable iptables07.# systemctl unmask iptables08.# iptables -F09.# service iptables save3. Install docker latest stable rpm provided by Docker.
1.# yum install -y yum-utils2.# yum-config-manager –add-repo https://docs.docker.com/engine/installation/linux/repo_files/centos/docker.repo3.# yum makecache fast4.# yum install -y docker-engine4. Inatll Kubernetes lates stable rpm provided kubernetes.
01.# cat <<EOF > /etc/yum.repos.d/kubernetes.repo02.[kubernetes]03.name=Kubernetes04.baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_6405.enabled=106.gpgcheck=107.repo_gpgcheck=110.EOF11. 12.# yum install -y docker kubelet kubeadm kubectl kubernetes-cni5. Enable and start kubernetes and docker services.
1.# systemctl enable docker &amp;amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp;amp; systemctl start docker2.# systemctl enable kubelet &amp;amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp;amp; systemctl start kubelet6. Kindly follow below steps on Kubernetes master Host:
1.# kubeadm init –pod-network-cidr=10.244.0.0/167. Below will be the output of kubeadm command:
01.[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.02.[preflight] Running pre-flight checks03.[init] Using Kubernetes version: v1.5.204.[tokens] Generated token: "4e4f80.fb6c903e351fb64c"05.[certificates] Generated Certificate Authority key and certificate.06.[certificates] Generated API Server key and certificate07.[certificates] Generated Service Account signing keys08.[certificates] Created keys and certificates in "/etc/kubernetes/pki"09.[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"10.[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"11.[apiclient] Created API client, waiting for the control plane to become ready12.[apiclient] All control plane components are healthy after 550.795507seconds13.[apiclient] Waiting for at least one node to register and become ready14.[apiclient] First node is ready after 3.002701 seconds15.[apiclient] Creating a test deployment16.[apiclient] Test deployment succeeded17.[token-discovery] Created the kube-discovery deployment, waiting for it to become ready18.[token-discovery] kube-discovery is ready after 533.505279 seconds19.[addons] Created essential addon: kube-proxy20.[addons] Created essential addon: kube-dns21.Your Kubernetes master has initialized successfully!22.You should now deploy a pod network to the cluster.23.Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:25.You can now join any number of machines by running the following on each node:26.kubeadm join --token=4e4f80.fb6c903e351fb64c 192.168.43.199
Above token is important as it will be used for joining other nodes in cluster.
8. By default Kubernetes will not start pods on master nodes for security reason you can remove this security if you are going to use single node.
1.# kubectl taint nodes --all dedicated-9. Run below command for flannel networking services:
1.# export ARCH=amd642.# curl -sSL "https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml?raw=true" | sed "s/amd64/${ARCH}/g" | kubectl create -f -10. Now wait for some more minutes and check all pods status.
1.# kubectl get pods --all-namespaces
Hi Admin..As you are coping things from our website syshunt.com, Please give our reference.
ReplyDelete