- Presentation: https://docs.google.com/presentation/d/10RURTFacQjXIpQP6FWoT8B5cohPUQsfrIjnD4VBKMFM/edit?usp=sharing
- cheatsheet: https://github.com/olebel/k8s-cheatsheet
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl enable docker
systemctl start docker
swapoff -a
# edit /etc/fstab, remove swap line
setenforce Permissive
# edit /etc/selinux/config
SELINUX=permissive
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[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
exclude=kube*
EOF
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable kubelet
systemctl start kubelet
journalctl -u kubelet -f
kubeadm init
export KUBECONFIG=/etc/kubernetes/admin.conf
docker ps
kubectl get pods --all-namespaces
systemctl status kubelet
# get deployment yaml
curl --location "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')" -o weave.yaml
# look inside
less weave.yaml
# apply
kubectl apply -f weave.yaml
kubeadm token create --print-join-command
kubeadm join 10.0.2.15:6443 ...
# check IP addresses on both machines
ifconfig
# reset cluster configuration (master, worker)
kubeadm reset
# recreate cluster advertising listening on private interface
kubeadm init --apiserver-advertise-address=172.28.28.10
# configure
kubeadm apply -f weave.yaml
# check pods, nodes
kubectl get svc
kubectl get nodes -o wide
kubectl get pods -o wide
# Join worker node to cluster
kubeadm token create --print-join-command
kubeadm join ...
# check pods
kubectl get pods -n kube-system
kubectl describe pods -n kube-system weave-net
# check containers on worker node
docker ps
docker logs ?
# Add required route ( each worker )
route add <cluster_ip> gw <master_ip>
# route add 10.96.0.1 gw 172.28.28.10
# from worker test
ping 10.96.0.1
telnet 10.96.0.1 443
# monitor nodes, pods status
kubectl get nodes
kubectl get pods -n kube-system
kubectl create deployment hello-node --image=gcr.io/hello-minikube-zero-install/hello-node
kubectl get pods
kubectl describe pods
# delete deployment
kubectl get deployments
kubectl delete deployment hello-node
kubeadm reset
kubeadm init --apiserver-advertise-address=172.28.28.10
kubeadm apply -f weave.yaml
# Join worker node to cluster
kubeadm token create --print-join-command
kubeadm join ...
kubectl create deployment hello-node --image=gcr.io/hello-minikube-zero-install/hello-node
kubectl get pods -o wide
# check app from worker and master node
curl <pod_ip>:8080