I use Ubuntu-1604 and each server has 4CPU, 8.0GMem, 50GDisk.
cat /proc/version Linux version 4.4.0-148-generic (buildd@lgw01-amd64-031) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10) ) #174-Ubuntu SMP Tue May 7 12:20:14 UTC 2019
Step 2). Install kubelet kubeadm kubectland docker at both nodes.
I’m not at US and I use below mirror to install it quickly. ssh the server first. Then run below.
ssh to the master node. Run kubeadm init Below messages show it is successful.
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 10.0.13.122:6443 --token bm31hs.xxx \
--discovery-token-ca-cert-hash sha256:xxx
Add private IP and host into /etc/hosts e.g. 10.0.13.122 kvm-019646
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.
Step 5). Check at master node.
kubectl get nodes
NAME STATUS ROLES AGE VERSION
kvm-019646 NotReady master 18m v1.15.0
kvm-019647 NotReady <none> 9s v1.15.0
Install calico or weave to enable network and network policies at Kubernetes clusters.
kubectl apply -f https://git.io/weave-kube-1.6
Then you could get Ready status.
kubectl get nodes
NAME STATUS ROLES AGE VERSION
kvm-019646 Ready master 40m v1.15.0
kvm-019647 Ready <none> 21m v1.15.0
Bravo, the k8s cluster is setup!
Step 6). Try the deployment.
Deploy below nginx deployment. Save below into nginx.yaml