因为之前搭建过centos上的服务网格,所以这次用ubuntu来快速搭建新的服务网格。只重点说与在centos上不同的部分。
准备条件:三个ubuntu服务器

1 关闭防火墙

sudo ufw disable

出来提示

Firewall stopped and disabled on system startup

2 永久关闭swap

vi /etc/fstab

在swap分区这行前加 # 禁用掉,保存退出。重启

reboot

3 修改hosts

省略

4 安装docker18.09.7

sudo apt install docker.io

5 修改docker的cgroups

cat << EOF > /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"]
}
{
  "registy-mirrors":["https://alzgoonw.mirror.aliyuncs.com"]
}
EOF

然后

systemctl daemon-reload
systemctl restart docker

查看

docker info

6 安装k8s

k8s.gcr.io/kube-apiserver:v1.16.0
k8s.gcr.io/kube-controller-manager:v1.16.0
k8s.gcr.io/kube-scheduler:v1.16.0
k8s.gcr.io/kube-proxy:v1.16.0
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.3.15-0
k8s.gcr.io/coredns:1.6.2
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

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

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.2.110:6443 --token vr0kbo.skkph939nmaza1h5 \
    --discovery-token-ca-cert-hash sha256:0db28c0ce72e85d48cae5c116644a117b9a176f87f6ebad2e7e95277575c53d7 

7 其他流程和在centos上类似,这里不再赘述,其实两者差不多,主要就是一些命令格式上有些不同。

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐