Skip to content

密钥不支持sudo #2412

Open
Open
@sundayhk

Description

What is version of KubeKey has the issue?

v3.1.6

What is your os environment?

Ubuntu 22.04.3 LTS

KubeKey config file

apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
  name: sundayhk
spec:
  hosts:
  - {name: ks-master01, address: 192.168.77.131, internalAddress: 192.168.77.131, user: sunday, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: ks-node01, address: 192.168.77.132, internalAddress: 192.168.77.132, user: sunday, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: ks-node02, address: 192.168.77.133, internalAddress: 192.168.77.133, user: sunday, privateKeyPath: "~/.ssh/id_rsa"}
  roleGroups:
    etcd:
    - ks-master01
    control-plane: 
    - ks-master01
    worker:
    - ks-node01
    - ks-node02
  controlPlaneEndpoint:
    ## Internal loadbalancer for apiservers 
    # internalLoadbalancer: haproxy

    domain: lb.kubesphere.local
    address: ""
    port: 6443
  kubernetes:
    version: v1.28.8
    clusterName: cluster.local
    autoRenewCerts: true
    containerManager: containerd
  etcd:
    type: kubekey
  network:
    plugin: calico
    kubePodsCIDR: 10.233.64.0/18
    kubeServiceCIDR: 10.233.0.0/18
    ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni
    multusCNI:
      enabled: false
  registry:
    privateRegistry: ""
    namespaceOverride: ""
    registryMirrors: []
    insecureRegistries: []
  addons: []

A clear and concise description of what happend.

使用password可以sudo执行,但使用密钥则sudo认证失败
sudo免密钥在主机登陆是正常的

Relevant log output

root@ks-master01:~# ./kk create cluster -f config-sample.yaml1


 _   __      _          _   __           
| | / /     | |        | | / /           
| |/ / _   _| |__   ___| |/ /  ___ _   _ 
|    \| | | | '_ \ / _ \    \ / _ \ | | |
| |\  \ |_| | |_) |  __/ |\  \  __/ |_| |
\_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |
                                    __/ |
                                   |___/

15:43:52 CST [GreetingsModule] Greetings
15:43:59 CST message: [ks-master01]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:43:59 CST retry: [ks-master01]
15:43:59 CST message: [ks-node01]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:43:59 CST retry: [ks-node01]
15:44:00 CST message: [ks-node02]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:44:00 CST retry: [ks-node02]
15:44:10 CST message: [ks-node01]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:44:10 CST retry: [ks-node01]
15:44:10 CST message: [ks-master01]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:44:10 CST retry: [ks-master01]
15:44:11 CST message: [ks-node02]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:44:11 CST retry: [ks-node02]
15:44:21 CST message: [ks-master01]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:44:21 CST message: [ks-node01]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:44:22 CST message: [ks-node02]
Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
15:44:22 CST failed: [ks-master01]
15:44:22 CST failed: [ks-node01]
15:44:22 CST failed: [ks-node02]
error: Pipeline[CreateClusterPipeline] execute failed: Module[GreetingsModule] exec failed: 
failed: [ks-master01] [Greetings] exec failed after 3 retries: Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
failed: [ks-node01] [Greetings] exec failed after 3 retries: Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1
failed: [ks-node02] [Greetings] exec failed after 3 retries: Failed to exec command: sudo -E /bin/bash -c "echo 'Greetings, KubeKey!'" 
Sorry, try again.
[sudo] password for sunday: 
Sorry, try again.
[sudo] password for sunday: 
sudo: 3 incorrect password attempts: Process exited with status 1

Additional information

No response

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions