繁体   English   中英

Kubectl连接到Azure ACS群集

[英]Kubectl connecting to Azure ACS cluster

我已成功将群集部署到Azure。 现在尝试设置kubectl来使用它。

正在运行:

az acs kubernetes get-credentials --resource-group=group --name=cluster

结果是:

scp: .kube/config: No such file or directory
Traceback (most recent call last):
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/main.py", line 36, in main
    cmd_result = APPLICATION.execute(args)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/application.py", line 212, in execute
    result = expanded_arg.func(params)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__
    return self.handler(*args, **kwargs)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 626, in _execute_command
    reraise(*sys.exc_info())
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 603, in _execute_command
    result = op(client, **kwargs) if client else op(**kwargs)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acs/custom.py", line 814, in k8s_get_credentials
    _k8s_get_credentials_internal(name, acs_info, path, ssh_key_file)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acs/custom.py", line 835, in _k8s_get_credentials_internal
    '.kube/config', path_candidate, key_filename=ssh_key_file)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acs/acs_client.py", line 64, in secure_copy
    scp.get(src, dest)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/scp.py", line 198, in get
    self._recv_all()
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/scp.py", line 348, in _recv_all
    raise SCPException(asunicode(msg[1:]))
SCPException: scp: .kube/config: No such file or directory

文件~/.kube/config存在,并且我可以ssh到集群的主节点。

知道我正在做什么会出错吗?

更新。

尝试按以下任一注释运行命令:

az acs kubernetes get-credentials --resource-group=group --name=cluster -f /Users/me/.kube/config --debug

并收到以下信息:

Password for private key:
paramiko.transport : starting thread (client mode): 0x9659890L
paramiko.transport : Local version/idstring: SSH-2.0-paramiko_2.3.1
paramiko.transport : Remote version/idstring: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
paramiko.transport : kex algos:[u'curve25519-sha256@libssh.org', u'ecdh-sha2-nistp256', u'ecdh-sha2-nistp384', u'ecdh-sha2-nistp521', u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group14-sha1'] server key:[u'ssh-rsa', u'rsa-sha2-512', u'rsa-sha2-256', u'ecdsa-sha2-nistp256', u'ssh-ed25519'] client encrypt:[u'chacha20-poly1305@openssh.com', u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com'] server encrypt:[u'chacha20-poly1305@openssh.com', u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com'] client mac:[u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-sha1'] server mac:[u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-sha1'] client compress:[u'none', u'zlib@openssh.com'] server compress:[u'none', u'zlib@openssh.com'] client lang:[u''] server lang:[u''] kex follows?False
paramiko.transport : Kex agreed: ecdh-sha2-nistp256
paramiko.transport : HostKey agreed: ecdsa-sha2-nistp256
paramiko.transport : Cipher agreed: aes128-ctr
paramiko.transport : MAC agreed: hmac-sha2-256
paramiko.transport : Compression agreed: none
paramiko.transport : kex engine KexNistp256 specified hash_algo <built-in function openssl_sha256>
paramiko.transport : Switch to new keys ...
paramiko.transport : Trying SSH key 765f702f5fff7fe30260d53b5bbb57eb
paramiko.transport : userauth is OK
paramiko.transport : Authentication (publickey) successful!
paramiko.transport : [chan 0] Max packet in: 32768 bytes
paramiko.transport : Received global request "hostkeys-00@openssh.com"
paramiko.transport : Rejecting "hostkeys-00@openssh.com" global request from server.
paramiko.transport : [chan 0] Max packet out: 32768 bytes
paramiko.transport : Secsh channel 0 opened.
paramiko.transport : [chan 0] Sesch channel 0 request ok
paramiko.transport : [chan 0] EOF received (0)
paramiko.transport : [chan 0] EOF sent (0)
scp: .kube/config: No such file or directory
Traceback (most recent call last):
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/main.py", line 36, in main
    cmd_result = APPLICATION.execute(args)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/application.py", line 212, in execute
    result = expanded_arg.func(params)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__
    return self.handler(*args, **kwargs)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 626, in _execute_command
    reraise(*sys.exc_info())
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 603, in _execute_command
    result = op(client, **kwargs) if client else op(**kwargs)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acs/custom.py", line 814, in k8s_get_credentials
    _k8s_get_credentials_internal(name, acs_info, path, ssh_key_file)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acs/custom.py", line 835, in _k8s_get_credentials_internal
    '.kube/config', path_candidate, key_filename=ssh_key_file)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/acs/acs_client.py", line 64, in secure_copy
    scp.get(src, dest)
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/scp.py", line 198, in get
    self._recv_all()
  File "/Users/me/lib/azure-cli/lib/python2.7/site-packages/scp.py", line 348, in _recv_all
    raise SCPException(asunicode(msg[1:]))
SCPException: scp: .kube/config: No such file or directory

azure cli的版本是2.0.18。 不胜感激建议。

尝试使用--file -f标志指定.kube目录中“ config”文件的绝对路径,您可以使用--debug进行进一步调试。

az acs kubernetes get-credentials --resource-group=group --name=cluster -f /.../.../.kube/config --debug

就我而言,.kube / config文件不是在主服务器上创建的。 尝试创建.kube / config文件时发生错误,我通过ssh-ing到主节点并查看/ var / log / azure目录注意到了这一错误。 错误与我的服务主体密码有关。 有了新的服务主体,新群集就可以正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM