this document just a supplement for official documentation , if you are newer with k8s install you should go to official doc for look up more info . usually you can install by accord official doc step by step smoothly.
this doc may help for you at below scene:
-
can’t access network get yum repository from google release and get aliyun release is fast
-
how install specify version of kubelet and kubeadm
-
can’t access network k8s.gcr.io for pull docker image and pull aliyun image is fast
replace yum repository config by aliyun
$ vim /etc/yum.repos.d/k8s.repo
replace official google release with below
[kubernetes] name=Kubernetes repo baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ gpgcheck=0 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg enabled=1
then install kubeadm and kubelet will at just some minute
$ yum install kubelet kubeadm -y
if you want install specify version of kubernetes you should download from rpm package find the baseurl at aliyun yum release which in your yum repository config property name baseurl
$ curl https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/230df4e2037cc1655d03586f837a4ecaf42fdbee7366ee2956e08ad1abd3ab8f-kubelet-1.16.10-0.x86_64.rpm -o kubelet-1.16.10.rpm $ rpm i kubelet-1.16.10.rpm
this method also apply for kubeadm
default kubeadm init images are k8s.gcr.io you could print default images use command like below
$ kubeadm config images list k8s.gcr.io/kube-apiserver:v1.17.6 k8s.gcr.io/kube-controller-manager:v1.17.6 k8s.gcr.io/kube-scheduler:v1.17.6 k8s.gcr.io/kube-proxy:v1.17.6 k8s.gcr.io/pause:3.1 k8s.gcr.io/etcd:3.4.3-0 k8s.gcr.io/coredns:1.6.5
you have to method to init by replace gcr images with aliyun images === retag image by pull aliyun image
$ docker image pull registry.aliyuncs.com/google_containers/kube-apiserver:v1.17.6 $ docker tag registry.aliyuncs.com/google_containers/kube-apiserver:v1.17.6 k8s.gcr.io/kube-apiserver:v1.17.6
retag all images then
$ kubeadm init
you can modify config file or pass arg command line, here I choose config file way
$ kubeadm config print init-defaults > kubeadm.conf
edit this file replace
imageRepository: k8s.gcr.io
with
imageRepository: registry.aliyuncs.com/google_containers
and then
$ kubeadm init --config kubadm.conf
install flannel plugin as official doc described, but here i have two notice for you
-
notice 1 (official doc mention it also) For flannel to work correctly, you must pass --pod-network-cidr=10.244.0.0/16 to kubeadm init.
-
notice 2 pass arg --iface={xxxx} if your network face is not normal(eth[\d]+) name , if won’t, you will found fail message when plugin working
this doc is Open Source software released under the Apache 2.0 license.