ansible一键安装k8s1.10x_and_k8s1.11x

2023年 7月 9日 61.9k 0

[root@localhost ~]# ansible-playbook /etc/ansible/roles/two.yaml
[DEPRECATION WARNING]: DEFAULT_SUDO_USER option, In favor of become which is a generic framework . This feature will be removed in
version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

PLAY [k8s-all] ********************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************
ok: [192.168.150.181]
ok: [192.168.150.184]
ok: [192.168.150.182]
ok: [192.168.150.183]

TASK [docker_kubeadm : 下载docker-selinux] ******************************************************************************************
changed: [192.168.150.184]
changed: [192.168.150.181]
changed: [192.168.150.183]
changed: [192.168.150.182]

TASK [docker_kubeadm : 下载docker] **************************************************************************************************
changed: [192.168.150.181]
changed: [192.168.150.183]
changed: [192.168.150.182]
changed: [192.168.150.184]

TASK [docker_kubeadm : 安装docker17.3] **********************************************************************************************
[WARNING]: Consider using yum module rather than running yum

changed: [192.168.150.184]
changed: [192.168.150.182]
changed: [192.168.150.183]
changed: [192.168.150.181]

TASK [docker_kubeadm : 修改配置文件/usr/lib/systemd/system/docker.service] **************************************************************
changed: [192.168.150.184]
changed: [192.168.150.181]
changed: [192.168.150.183]
changed: [192.168.150.182]

TASK [docker_kubeadm : 设置docker自启动] ***********************************************************************************************
changed: [192.168.150.184]
changed: [192.168.150.182]
changed: [192.168.150.181]
changed: [192.168.150.183]

TASK [docker_kubeadm : 添加阿里云K8S源] *************************************************************************************************
changed: [192.168.150.182]
changed: [192.168.150.181]
changed: [192.168.150.184]
changed: [192.168.150.183]

TASK [docker_kubeadm : 安装kubeadm1.11.1] *******************************************************************************************
changed: [192.168.150.183] => (item=[u’kubeadm-1.11.1-0.x86_64′, u’kubectl-1.11.1-0.x86_64′, u’kubelet-1.11.1-0.x86_64′])
changed: [192.168.150.184] => (item=[u’kubeadm-1.11.1-0.x86_64′, u’kubectl-1.11.1-0.x86_64′, u’kubelet-1.11.1-0.x86_64′])
changed: [192.168.150.181] => (item=[u’kubeadm-1.11.1-0.x86_64′, u’kubectl-1.11.1-0.x86_64′, u’kubelet-1.11.1-0.x86_64′])
changed: [192.168.150.182] => (item=[u’kubeadm-1.11.1-0.x86_64′, u’kubectl-1.11.1-0.x86_64′, u’kubelet-1.11.1-0.x86_64′])

TASK [docker_kubeadm : kubectl命令补全] ***********************************************************************************************
changed: [192.168.150.181]
changed: [192.168.150.183]
changed: [192.168.150.182]
changed: [192.168.150.184]

TASK [k8s10x : 修改10-kubeadm.conf的cgroupfs] ****************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : 修改10-kubeadm.conf的cgroupfs] ****************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : 设置kubelet自启动] ******************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : 分发配置文件] ************************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : pull pause-amd64:3.1] *********************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : 初始化第一个master节点,如果失败会终止整个k8s集群的初始化] *********************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : 证书打包] **************************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : 证书上传到/etc/ansible/roles/k8s/files/] ********************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : 证书cp] **************************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : 解压证书] **************************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : kubeadm init] ******************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s10x : inited] ************************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [k8s11x : 修改 /etc/sysconfig/kubelet] *****************************************************************************************
changed: [192.168.150.181]
changed: [192.168.150.184]
changed: [192.168.150.182]
changed: [192.168.150.183]

TASK [k8s11x : 设置kubelet自启动] ******************************************************************************************************
changed: [192.168.150.183]
changed: [192.168.150.181]
changed: [192.168.150.182]
changed: [192.168.150.184]

TASK [k8s11x : 配置文件分发] ************************************************************************************************************
skipping: [192.168.150.184]
changed: [192.168.150.183]
changed: [192.168.150.182]
changed: [192.168.150.181]

TASK [k8s11x : 配置文件提前拉取镜像] ********************************************************************************************************
skipping: [192.168.150.184]
changed: [192.168.150.183]
changed: [192.168.150.182]
changed: [192.168.150.181]

TASK [k8s11x : pause-amd64:3.1镜像bug处理] ********************************************************************************************
changed: [192.168.150.181]
changed: [192.168.150.183]
changed: [192.168.150.182]
changed: [192.168.150.184]

TASK [k8s11x : pause-amd64:3.1镜像bug处理] ********************************************************************************************
changed: [192.168.150.184]
changed: [192.168.150.181]
changed: [192.168.150.183]
changed: [192.168.150.182]

TASK [k8s11x : kubeadm初始化,如果失败会终止整个k8s集群的初始化] *************************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]
changed: [192.168.150.181]

TASK [k8s11x : 证书打包] **************************************************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]
changed: [192.168.150.181]

TASK [k8s11x : 证书上传到/etc/ansible/roles/k8s/files/] ********************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]
changed: [192.168.150.181]

TASK [k8s11x : 证书cp] **************************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.184]
changed: [192.168.150.182]
changed: [192.168.150.183]

TASK [k8s11x : 解压证书] **************************************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.184]
changed: [192.168.150.182]
changed: [192.168.150.183]

TASK [k8s11x : kubeadm init其他master] **********************************************************************************************
skipping: [192.168.150.181]
skipping: [192.168.150.184]
changed: [192.168.150.183]
changed: [192.168.150.182]

TASK [k8s11x : inited] ************************************************************************************************************
skipping: [192.168.150.184]
[WARNING]: Consider using file module with state=directory rather than running mkdir

changed: [192.168.150.182]
changed: [192.168.150.183]
changed: [192.168.150.181]

TASK [k8s11x : 设置master运行容器] ******************************************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]
changed: [192.168.150.181]

TASK [flannel : down flannel.yaml] ************************************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]
changed: [192.168.150.181]

TASK [flannel : deploy flannel] ***************************************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]
fatal: [192.168.150.181]: FAILED! => {“changed”: true, “cmd”: “kubectl apply -f /root/kube-flannel.yml”, “delta”: “0:00:52.136940”, “end”: “2018-11-02 11:28:07.527905”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2018-11-02 11:27:15.390965”, “stderr”: “error: error when creating \”/root/kube-flannel.yml\”: Post https://192.168.150.186:6443/apis/extensions/v1beta1/namespaces/kube-system/daemonsets: unexpected EOF; some request body already written”, “stderr_lines”: [“error: error when creating \”/root/kube-flannel.yml\”: Post https://192.168.150.186:6443/apis/extensions/v1beta1/namespaces/kube-system/daemonsets: unexpected EOF; some request body already written”], “stdout”: “clusterrole.rbac.authorization.k8s.io/flannel created\nclusterrolebinding.rbac.authorization.k8s.io/flannel created\nserviceaccount/flannel created\nconfigmap/kube-flannel-cfg created\ndaemonset.extensions/kube-flannel-ds-amd64 created\ndaemonset.extensions/kube-flannel-ds-arm64 created\ndaemonset.extensions/kube-flannel-ds-arm created\ndaemonset.extensions/kube-flannel-ds-ppc64le created”, “stdout_lines”: [“clusterrole.rbac.authorization.k8s.io/flannel created”, “clusterrolebinding.rbac.authorization.k8s.io/flannel created”, “serviceaccount/flannel created”, “configmap/kube-flannel-cfg created”, “daemonset.extensions/kube-flannel-ds-amd64 created”, “daemonset.extensions/kube-flannel-ds-arm64 created”, “daemonset.extensions/kube-flannel-ds-arm created”, “daemonset.extensions/kube-flannel-ds-ppc64le created”]}

TASK [addnode : kubeadm token] ***************************************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [addnode : 设置变量k8s_token为set_fact] *******************************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
skipping: [192.168.150.184]

TASK [addnode : add node to k8s cluster] ******************************************************************************************
skipping: [192.168.150.182]
skipping: [192.168.150.183]
fatal: [192.168.150.184]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute ‘k8s_token’\n\nThe error appears to have been in ‘/etc/ansible/roles/addnode/tasks/main.yaml’: line 11, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: add node to k8s cluster\n ^ here\n\nexception type: \nexception: ‘dict object’ has no attribute ‘k8s_token'”}
to retry, use: –limit @/etc/ansible/roles/two.retry

PLAY RECAP ************************************************************************************************************************
192.168.150.181 : ok=21 changed=20 unreachable=0 failed=1
192.168.150.182 : ok=19 changed=18 unreachable=0 failed=0
192.168.150.183 : ok=19 changed=18 unreachable=0 failed=0
192.168.150.184 : ok=13 changed=12 unreachable=0 failed=1
这个是要怎么解决呢

lucky5年前 (2018-11-02)登录以回复

相关文章

KubeSphere 部署向量数据库 Milvus 实战指南
探索 Kubernetes 持久化存储之 Longhorn 初窥门径
征服 Docker 镜像访问限制!KubeSphere v3.4.1 成功部署全攻略
那些年在 Terraform 上吃到的糖和踩过的坑
无需 Kubernetes 测试 Kubernetes 网络实现
Kubernetes v1.31 中的移除和主要变更

发布评论