rancher 启动k8s集群

本来启动k8s集群还是很麻烦的事情,步骤非常多,但是有了rancher帮忙,还是很轻松了,安装过程中遇到两个问题:

  1. docker下载失败,或者非常慢。
  2. rancher启动第一个k8s节点后就不能启动第二个节点了。

docker启动慢可以通过修改/etc/docker/daemon.json来搞定

{
  "registry-mirrors": [
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://3laho3y3.mirror.aliyuncs.com",
    "http://f1361db2.m.daocloud.io",
    "https://registry.docker-cn.com"
  ],
  "insecure-registries": [],
  "debug": true,
  "experimental": true
}

有时候修改完这个文件后,docker起不来,先删除所有containner和images后就可以了,有可能是image的layer不同造成的。

启动rancher主机,拷贝命令之前,一定要给主机从新命名,否则名字冲突,没办法启动第二台主机。

hostnamectl  set-hostname  master0

hostnamectl  set-hostname  master1

hostnamectl  set-hostname  master2

hostnamectl  set-hostname  worker0

hostnamectl  set-hostname  worker1

hostnamectl  set-hostname  worker2

最后拷贝最新的kubectl到你跑命令的机器上(需要科学上网)

https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl

然后再添加自动补全功能:

yum install bash-completion

source /usr/share/bash-completion/bash_completion

在网上下载的nfs在k8s里面自动创建pv的实例不成功。

找了好久发现是docker images没下下来,国内弄k8s啊,那些外面来的docker images一定要记住替换一下,否则下不下来,一个很简单的问题也要搞半天。

就这个起不来:

nfs-client-provisioner-5f74cfb769-pqlkl

替换deployment.yaml里面的image: docker.io/jmgao1983/nfs-client-provisioner:latest

替换前可以用docker search 搜索一下。

发布了72 篇原创文章 · 获赞 4 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_15156403/article/details/105557512