Last active
January 8, 2020 10:09
-
-
Save wuhanstudio/ae517998c80fd26d593ad984d6cf8fd4 to your computer and use it in GitHub Desktop.
kubeadm
This file contains 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
# Pull Images | |
kubeadm config images list |sed -e 's/^/docker pull /g' -e 's#k8s.gcr.io#gcr.azk8s.cn/google_containers#g' |sh -x | |
# Retag Images | |
docker images |grep google_containers |awk '{print "docker tag ",$1":"$2,$1":"$2}' |sed -e 's#gcr.azk8s.cn/google_containers#k8s.gcr.io#2' |sh -x | |
# Remove previous images | |
docker images |grep google_containers |awk '{print "docker rmi ", $1":"$2}' |sh -x | |
# Kubeadm | |
kubeadm reset | |
kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.100.1 | |
# Configuration | |
sudo cp /etc/kubernetes/admin.conf $HOME/ | |
sudo chown $(id -u):$(id -g) $HOME/admin.conf | |
export KUBECONFIG=$HOME/admin.conf # Append this to ~/.bashrc | |
# Join nodes | |
kubeadm token create --print-join-command # execute join command on each node | |
# Set Networking | |
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml | |
# Set Labels | |
kubectl label node ecs-sn3-medium-2-linux-20191120180955 node-role.kubernetes.io/worker=worker | |
# kubectl get nodes | |
# Load Balancer | |
helm fetch --untar stable/metallb | |
cd metallb | |
vim values.yaml | |
configInline: | |
# Example ARP Configuration | |
address-pools: | |
- name: default | |
protocol: layer2 | |
addresses: | |
- 192.168.100.170-192.168.100.175 | |
helm install metallb ./ | |
# Allow master to run pod | |
kubectl taint nodes --all node-role.kubernetes.io/master- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment