Install Kubernetes on single node using kubeadm
Set Host name:
[root@crio ~]# cat /etc/hosts
192.168.17.17 crio crio.cloud.local
Disable SELinux:
[root@crio ~]# setenforce 0
[root@crio ~]# sed -i --follow-symlinks 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
Disable Firewall:
[root@crio ~]# systemctl disable firewalld && systemctl stop firewalld
Disable swap:
[root@crio ~]# sed -i '/swap/d' /etc/fstab && swapoff -a
Update sysctl settings for Kubernetes networking:
[root@crio ~]# cat >>/etc/sysctl.d/kubernetes.conf<<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
[root@crio ~]# sysctl --system
Add yum repository:
[root@crio ~]# cat >>/etc/yum.repos.d/kubernetes.repo<<EOF
[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
EOF
Install Kubernetes:
[root@crio ~]# yum install -y kubeadm kubelet kubectl docker
Enable and Start kubelet & docker service:
[root@crio ~]# for x in docker kubelet
do
systemctl start $x; systemctl enable $x
done
Initialize Kubernetes Cluster:
[root@crio ~]# kubeadm init --apiserver-advertise-address=192.168.17.17 --pod-network-cidr=10.244.0.0/16
[root@crio ~]# mkdir -p $HOME/.kube
[root@crio ~]# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[root@crio ~]# chown $(id -u):$(id -g) $HOME/.kube/config
Deploy flannel network:
[root@crio ~]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
[root@crio ~]# kubectl get pod --all-namespaces
[root@crio ~]# kubectl get pod --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-86c58d9df4-mvx5c 1/1 Running 0 108m
kube-system coredns-86c58d9df4-vvg6k 1/1 Running 0 108m
kube-system etcd-crio.cloud.local 1/1 Running 0 107m
kube-system kube-apiserver-crio.cloud.local 1/1 Running 0 107m
kube-system kube-controller-manager-crio.cloud.local 1/1 Running 1 107m
kube-system kube-flannel-ds-amd64-gz2n4 1/1 Running 0 106m
kube-system kube-proxy-4t6hx 1/1 Running 0 108m
kube-system kube-scheduler-crio.cloud.local 1/1 Running 1 107m
[root@crio ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
crio.cloud.local Ready master 111m v1.13.4
Good Luck
https://www.linkedin.com/in/ahmedms/
Comments
Post a Comment