使用kubeadm一键部署kubernetes集群
此链接中有kubeadm v1.10.3安装 用了flannel网络 我使用calico网络https://blog.csdn.net/nklinsirui/article/details/80602724github地址https://github.com/cookcodeblog/k8s-deploykubeadm_init.sh#!/bin/bashset -e# Reset fi...
·
此链接中有kubeadm v1.10.3安装 用了flannel网络 我使用calico网络
https://blog.csdn.net/nklinsirui/article/details/80602724
github地址
https://github.com/cookcodeblog/k8s-deploy
kubeadm_init.sh
#!/bin/bash
set -e
# Reset firstly if ran kubeadm init before
kubeadm reset
# kubeadm init with flannel network
export KUBE_REPO_PREFIX="registry.cn-shenzhen.aliyuncs.com/cookcodeblog"
export KUBE_ETCD_IMAGE="registry.cn-shenzhen.aliyuncs.com/cookcodeblog/etcd-amd64:3.1.12"
kubeadm init --kubernetes-version=v1.10.3 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.56.102
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
cp -p $HOME/.bash_profile $HOME/.bash_profile.bak$(date '+%Y%m%d%H%M%S')
echo "export KUBECONFIG=$HOME/.kube/config" >> $HOME/.bash_profile
source $HOME/.bash_profile
pull_calico_images.sh
#!/bin/bash
set -e
# pull calico images
ETCD_VERSION=v3.1.10
NODE_VERSION=v3.0.8
CNI_VERSION=v2.0.6
KUB-CONTROLLERS_VERSION=v2.0.5
GCR_URL=quay.io/calico
CALICO_URL=calico
images=(etcd:${ETCD_VERSION}
node:${NODE_VERSION}
cni:${CNI_VERSION}
kube-controllers:${KUB-CONTROLLERS_VERSION})
for imageName in ${images[@]} ; do
docker pull $CALICO_URL/$imageName
docker tag $CALICO_URL/$imageName $GCR_URL/$imageName
docker rmi $CALICO_URL/$imageName
done
install_calico.sh
#!/bin/bash
set -e
wget https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml
kubectl apply -f calico.yaml
# Wait a while to let network takes effect
sleep 10
kubectl get pods --all-namespaces
# Check component status
kubectl get cs
# Check pods status incase any pods are not in running status
kubectl get pods --all-namespaces
安装calico
kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献1条内容
所有评论(0)