使用流浪汉/ Ansible进行Kubernetes安装时出现错误:sudo:需要密码\ n“}

时间:2019-05-05 14:30:20

标签: kubernetes ansible vagrant virtualbox

我试图使用Ansible在Mac上的Virtualbox上设置Kubernetes,并遇到https://kubernetes.io/blog/2019/03/15/kubernetes-setup-using-ansible-and-vagrant/

无所事事,我得到了错误:

TASK [Copy join command to local file] *****************************************
fatal: [k8s-master]: FAILED! => {"msg": "Failed to get information on remote file (join-command): sudo: a password is required\n"}

手动执行该步骤:

- name: Generate join command
    command: kubeadm token create --print-join-command
    #command: kubeadm token create --ignore-preflight-errors all --print-join-command
    register: join_command

给我:

root@k8s-master:~# kubeadm token create --print-join-command
kubeadm join 192.168.50.10:6443 --token q7jjp5.jdrd05uh9o4qilig     --discovery-token-ca-cert-hash sha256:52910f75eb6a9e10a38641e757d5a171273d62bd8ec12090e9a932914106d7da

现在,如果我运行实际的kubeadm join命令:

kubeadm join 192.168.50.10:6443 --token q7jjp5.jdrd05uh9o4qilig     --discovery-token-ca-cert-hash sha256:52910f75eb6a9e10a38641e757d5a171273d62bd8ec12090e9a932914106d7da
[preflight] Running pre-flight checks
    [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR DirAvailable--etc-kubernetes-manifests]: /etc/kubernetes/manifests is not empty
    [ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
    [ERROR Port-10250]: Port 10250 is in use
    [ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

kubeadm join 192.168.50.10:6443 --token q7jjp5.jdrd05uh9o4qilig     --discovery-token-ca-cert-hash sha256:52910f75eb6a9e10a38641e757d5a171273d62bd8ec12090e9a932914106d7da --ignore-preflight-errors all
[preflight] Running pre-flight checks
    [WARNING DirAvailable--etc-kubernetes-manifests]: /etc/kubernetes/manifests is not empty
    [WARNING FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
    [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
    [WARNING Port-10250]: Port 10250 is in use
    [WARNING FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.14" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Activating the kubelet service
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

仍然:

root@k8s-master:~# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?

关于上下文:

kubectl config view
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []

0 个答案:

没有答案