k8s在ubuntu16.4上的实验

首先就是安装,https://kubernetes.io/docs/setup/independent/install-kubeadm/
准备三台 vm(4cpu-8G)
10.88.1.170
10.88.1.171
10.88.1.172

docker 略过,先解决源的问题

apt-get update && apt-get install -y apt-transport-https
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add - 
cat </etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF  
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl

当然要 ansible k8s -uroot -a “xxx”

二、初始化master(170)

cat /etc/default/kubelet
KUBELET_EXTRA_ARGS=--cgroup-driver=
docker pull hulupiao/kube-apiserver-amd64:v1.11.2           
docker pull hulupiao/kube-controller-manager-amd64:v1.11.2 
docker pull hulupiao/kube-scheduler-amd64:v1.11.2          
docker pull hulupiao/kube-proxy-amd64:v1.11.2              
docker pull hulupiao/pause:3.1                            
docker pull hulupiao/etcd-amd64:3.2.18                     
docker pull hulupiao/coredns:1.1.3                         

docker tag hulupiao/kube-apiserver-amd64:v1.11.2           k8s.gcr.io/kube-apiserver-amd64:v1.11.2           
docker tag hulupiao/kube-controller-manager-amd64:v1.11.2  k8s.gcr.io/kube-controller-manager-amd64:v1.11.2 
docker tag hulupiao/kube-scheduler-amd64:v1.11.2           k8s.gcr.io/kube-scheduler-amd64:v1.11.2          
docker tag hulupiao/kube-proxy-amd64:v1.11.2               k8s.gcr.io/kube-proxy-amd64:v1.11.2              
docker tag hulupiao/pause:3.1                              k8s.gcr.io/pause:3.1                            
docker tag hulupiao/etcd-amd64:3.2.18                      k8s.gcr.io/etcd-amd64:3.2.18                     
docker tag hulupiao/coredns:1.1.3                          k8s.gcr.io/coredns:1.1.3                         

#不要问我为什么这么费劲,如果有代理可以参考 https://docs.docker.com/config/daemon/systemd/#httphttps-proxy
kubeadm init --kubernetes-version=1.11.2 --apiserver-advertise-address 10.88.1.170 --pod-network-cidr=10.88.1.0/24

[ERROR Swap]: running with swap on is not supported. Please disable swap
swapoff -a
修改 /etc/fstab 永久关闭下
开启 net.ipv4.forward=1
sysctl -p

发表评论

电子邮件地址不会被公开。 必填项已用*标注