[root@k8s ~]# kubeadm init [init] using Kubernetes version: v1.12.2 [preflight] running pre-flight checks [WARNING Firewalld]: firewalld is active, please ensure ports [6443 10250] are open or your cluster may not function correctly [preflight] The system verification failed. Printing the output from the verification: KERNEL_VERSION: 3.10.0-862.14.4.el7.x86_64 CONFIG_NAMESPACES: enabled CONFIG_NET_NS: enabled CONFIG_PID_NS: enabled CONFIG_IPC_NS: enabled CONFIG_UTS_NS: enabled CONFIG_CGROUPS: enabled CONFIG_CGROUP_CPUACCT: enabled CONFIG_CGROUP_DEVICE: enabled CONFIG_CGROUP_FREEZER: enabled CONFIG_CGROUP_SCHED: enabled CONFIG_CPUSETS: enabled CONFIG_MEMCG: enabled CONFIG_INET: enabled CONFIG_EXT4_FS: enabled (as module) CONFIG_PROC_FS: enabled CONFIG_NETFILTER_XT_TARGET_REDIRECT: enabled (as module) CONFIG_NETFILTER_XT_MATCH_COMMENT: enabled (as module) CONFIG_OVERLAY_FS: enabled (as module) CONFIG_AUFS_FS: not set - Required for aufs. CONFIG_BLK_DEV_DM: enabled (as module) DOCKER_VERSION: 18.09.0 OS: Linux CGROUPS_CPU: enabled CGROUPS_CPUACCT: enabled CGROUPS_CPUSET: enabled CGROUPS_DEVICES: enabled CGROUPS_FREEZER: enabled CGROUPS_MEMORY: enabled [WARNING Hostname]: hostname "k8s" could not be reached [WARNING Hostname]: hostname "k8s" lookup k8s on 116.228.111.118:53: no such host [preflight] Some fatal errors occurred: [ERROR Swap]: running with swap on is not supported. Please disable swap [ERROR SystemVerification]: unsupported docker version: 18.09.0 [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
巨大的 ERROR 错误,kubeadm 不支持 18.09 的 Docker 版本,只得降级。
1
yum downgrade docker-ce-18.06.1.ce
用 yum 直接这样降级会报一堆文件冲突错误:
1 2 3 4
Transaction check error: file /usr/bin/docker from install of docker-ce-18.06.1.ce-3.el7.x86_64 conflicts with file from package docker-ce-cli-1:18.09.0-3.el7.x86_64 file /usr/share/bash-completion/completions/docker from install of docker-ce-18.06.1.ce-3.el7.x86_64 conflicts with file from package docker-ce-cli-1:18.09.0-3.el7.x86_64 ...
docker tag gcrxio/kube-apiserver:v1.12.2 k8s.gcr.io/kube-apiserver:v1.12.2 docker tag gcrxio/kube-controller-manager:v1.12.2 k8s.gcr.io/kube-controller-manager:v1.12.2 docker tag gcrxio/kube-scheduler:v1.12.2 k8s.gcr.io/kube-scheduler:v1.12.2 docker tag gcrxio/kube-proxy:v1.12.2 k8s.gcr.io/kube-proxy:v1.12.2 docker tag gcrxio/pause:3.1 k8s.gcr.io/pause:3.1 docker tag gcrxio/etcd:3.2.24 k8s.gcr.io/etcd:3.2.24 docker tag gcrxio/coredns:1.2.2 k8s.gcr.io/coredns:1.2.2
再次执行 kubeadm init 初始化成功。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
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/
You can now join any number of machines by running the following on each node as root:
[root@k8s ~]# kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')" serviceaccount/weave-net created clusterrole.rbac.authorization.k8s.io/weave-net created clusterrolebinding.rbac.authorization.k8s.io/weave-net created role.rbac.authorization.k8s.io/weave-net created rolebinding.rbac.authorization.k8s.io/weave-net created daemonset.extensions/weave-net created
安装 weave scope:
1 2 3 4 5 6 7 8
[root@k8s ~]# kubectl apply -f "https://cloud.weave.works/k8s/scope.yaml?k8s-version=$(kubectl version | base64 | tr -d '\n')" namespace/weave created serviceaccount/weave-scope created clusterrole.rbac.authorization.k8s.io/weave-scope created clusterrolebinding.rbac.authorization.k8s.io/weave-scope created deployment.apps/weave-scope-app created service/weave-scope-app created daemonset.extensions/weave-scope-agent created