Last active
May 23, 2019 04:39
-
-
Save jwthanh/2de1f97194ef1891c3a012597bf26d42 to your computer and use it in GitHub Desktop.
Kubernetes installation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# should apply this config if pod could not ping outside internet | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: kube-dns | |
namespace: kube-system | |
data: | |
upstreamNameservers: | | |
["8.8.8.8", "8.8.4.4"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install -y kubelet kubeadm kubectl | |
apt-mark hold kubelet kubeadm kubectl | |
kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=<public_ip> | |
kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml | |
kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml | |
kubectl taint nodes --all node-role.kubernetes.io/master- #if want to run pods on master node | |
snap install helm --classic | |
helm init --upgrade --service-account tiller | |
kubectl create serviceaccount --namespace kube-system tiller | |
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller | |
kubectl patch deploy --namespace kube-system helm install stable/nginx-ingress --namespace kube-system --set controller.hostNetwork=true,controller.kind=DaemonSet,rbac.create=truestem tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' | |
helm install stable/kube-lego --namespace kube-system --set [email protected],config.LEGO_URL=https://acme-v01.api.letsencrypt.org/directory,rbac.create=true | |
To install specific version of the package it is enough to define it during the apt-get install command: | |
apt-get install -qy kubeadm=<version> | |
But in the current case kubectl and kubelet packages are installed by dependencies when we install kubeadm, so all these three packages should be installed with a specific version: | |
$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \ | |
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \ | |
sudo apt-get update -q && \ | |
sudo apt-get install -qy kubelet=<version> kubectl=<version> kubeadm=<version> | |
where available <version> is: | |
curl -s https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep Version | awk '{print $2}' | |
For your particular case it is: | |
$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \ | |
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \ | |
sudo apt-get update -q && \ | |
sudo apt-get install -qy kubelet=1.9.6-00 kubectl=1.9.6-00 kubeadm=1.9.6-00 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment