kubeadm基於OKDC腳本,一鍵安裝kubernetes 1.6.2 (在線版)

1. install scriptnode

#1. config yum repo
cat <<EOF |sudo tee /etc/yum.repos.d/kube.repo
[extras]
name=extras
baseurl=http://mirrors.aliyun.com/centos/7/extras/x86_64/
gpgcheck=0
enabled=1

[updates]
name=updates
baseurl=http://mirrors.aliyun.com/centos/7/updates/x86_64/
gpgcheck=0
enabled=1
EOF
sudo yum updateinfo

#2. install lsb_release package
sudo yum install -y redhat-lsb-core

#3. manual install docker & kube package
#sudo yum install -y kubectl kubernetes-cni kubelet kubeadm docker 
#sudo systemctl enable docker
#sudo systemctl start docker

#4. manual import images
#tar zxpvf /tmp/registry.aliyuncs.com-archon.package.tar.gz
#sudo docker load -i registry.aliyuncs.com-archon.hyperkube-amd64.v1.6.2.tar
#sudo docker load -i registry.aliyuncs.com-archon.fannel.v0.7.1.tar
#sudo docker load -i registry.aliyuncs.com-archon.etcd.3.0.17.tar
#sudo docker load -i registry.aliyuncs.com-archon.pause-amd64.tar.3.0.tar

#sudo docker tag 47c16ab7f7d0 registry.aliyuncs.com/archon/hyperkube-amd64:v1.6.2
#sudo docker tag cd4ae0be5e1b registry.aliyuncs.com/archon/flannel:v0.7.1-amd64
#sudo docker tag 243830dae7dd registry.aliyuncs.com/archon/etcd:3.0.17
#sudo docker tag 99e59f495ffa registry.aliyuncs.com/archon/pause-amd64:3.0


#3. install kube
curl -s https://raw.githubusercontent.com/kubeup/okdc/master/okdc-centos.sh > okdc.sh
sudo sh okdc.sh

2. run loggit

[mac@Centos73 ~]$ sudo sh okdc.sh
OKDC v1.1 by kubeup
One-liner Kubernetes Deployment in China
http://github.com/kubeup/okdc

This will help you provision Kubernetes v1.6.2 master on this machine. 

The following mirrors will be used due to inaccessibility of official resources.
https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
registry.aliyuncs.com/archon/hyperkube-amd64:v1.6.2
registry.aliyuncs.com/archon/etcd:3.0.17

You will be prompted to input custom docker hub mirror and preferred network layer.

Are you sure to continue? (y/N) y
Loaded plugins: fastestmirror
kubernetes                                                                                                                 | 1.3 kB  00:00:00     
kubernetes/primary                                                                                                         | 2.7 kB  00:00:00     
Loading mirror speeds from cached hostfile
kubernetes                                                                                                                                  14/14
updateinfo summary done
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package kubectl-1.6.2-0.x86_64 already installed and latest version
Package kubernetes-cni-0.5.1-0.x86_64 already installed and latest version
Package 2:docker-1.12.6-16.el7.centos.x86_64 already installed and latest version
Package kubelet-1.6.2-0.x86_64 already installed and latest version
Package kubeadm-1.6.2-0.x86_64 already installed and latest version
Nothing to do
Docker registry mirror, ex. Aliyun accelerator? (empty to skip) 
Created symlink from /etc/systemd/system/multi-user.target.wants/kubelet.service to /etc/systemd/system/kubelet.service.
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.6.2
[init] Using Authorization mode: RBAC
[preflight] Skipping pre-flight checks
[certificates] Generated CA certificate and key.
[certificates] Generated API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [Centos73 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.0.192]
[certificates] Generated API server kubelet client certificate and key.
[certificates] Generated service account token signing key and public key.
[certificates] Generated front-proxy CA certificate and key.
[certificates] Generated front-proxy client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready
[apiclient] All control plane components are healthy after 21.522292 seconds
[apiclient] Waiting for at least one node to register
[apiclient] First node has registered after 6.003236 seconds
[token] Using token: an0m5l.c01thva8k6w5wxlk
[apiconfig] Created RBAC rules
[addons] Created essential addon: kube-proxy
[addons] Created essential addon: kube-dns

Your Kubernetes master has initialized successfully!

To start using your cluster, you need to run (as a regular user):

  sudo cp /etc/kubernetes/admin.conf $HOME/
  sudo chown $(id -u):$(id -g) $HOME/admin.conf
  export KUBECONFIG=$HOME/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  http://kubernetes.io/docs/admin/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join --token an0m5l.c01thva8k6w5wxlk 192.168.0.192:6443

Available network layer:
1) Flannel
2) Calico (mem>1.5G && requires a docker mirror)
3) Skip 
Choose one to install: 1--2017-05-08 23:00:03--  https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.72.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.72.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2176 (2.1K) [text/plain]
Saving to: ‘/tmp/flannel.yaml’

100%[========================================================================================================>] 2,176       --.-K/s   in 0s      

2017-05-08 23:00:05 (27.5 MB/s) - ‘/tmp/flannel.yaml’ saved [2176/2176]

clusterrole "flannel" created
clusterrolebinding "flannel" created
serviceaccount "flannel" created
configmap "kube-flannel-cfg" created
daemonset "kube-flannel-ds" created


Run the following command on your nodes to join the cluster

curl -s https://raw.githubusercontent.com/kubeup/okdc/master/okdc-centos.sh|TOKEN=an0m5l.c01thva8k6w5wxlk MASTER=192.168.0.192:6443 sh
Done
相關文章
相關標籤/搜索