Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubespray,带堡垒和自定义SSH端口+;代理转发_Ssh_Kubernetes_Kubespray - Fatal编程技术网

Kubespray,带堡垒和自定义SSH端口+;代理转发

Kubespray,带堡垒和自定义SSH端口+;代理转发,ssh,kubernetes,kubespray,Ssh,Kubernetes,Kubespray,是否可以将Kubespray与堡垒一起使用,但在海关港口使用,并与代理转运一起使用?如果不支持,您需要做哪些更改?始终,因为您可以在三个不同的级别进行配置:通过主机用户的~/.ssh/config,通过带有组变量的整个playbook,或作为内联配置(即,在命令行或清单文件中) ssh配置很简单: Host 1.2.* *.example.com # or whatever pattern matches the target instances ProxyJump someuser@som

是否可以将Kubespray与堡垒一起使用,但在海关港口使用,并与代理转运一起使用?如果不支持,您需要做哪些更改?

始终,因为您可以在三个不同的级别进行配置:通过主机用户的
~/.ssh/config
,通过带有
组变量的整个playbook,或作为内联配置(即,在命令行或清单文件中)

ssh配置很简单:

Host 1.2.* *.example.com # or whatever pattern matches the target instances
  ProxyJump someuser@some-bastion:1234
  # and then the Agent should happen automatically, unless you mean
  # ForwardAgent yes
接下来我将讨论内联配置,因为它有点简单:

ansible-playbook -i whatever \
    -e '{"ansible_ssh_common_args": "-o ProxyJump=\"someuser@jump-host:1234\""}' \
    cluster.yaml
或以相同的方式通过库存:

master-host-0 ansible_host=1.2.3.4 ansible_ssh_common_args="-o ProxyJump='someuser@jump-host:1234'"
或者通过
group\u vars
,您可以将其添加到现有的
group\u vars/all.yml
,或者如果它不存在,则创建包含
all.yml
文件的
group\u vars
目录,作为包含库存文件的目录的子目录

如果您的ssh配置比您希望在inventory/command-line/group_vars中编码的更复杂,您还可以通过以下变量指示ansible调用的ssh使用专用配置文件:

ansible-playbook -e '{"ansible_ssh_extra_args": "-F /path/to/special/ssh_config"}' ...

在我需要访问特定端口上的主机的情况下,我只需将主机的
~/.ssh/config
修改为:

Host 10.40.45.102
  ForwardAgent yes
  User root
  ProxyCommand ssh -W %h:%p -p 44057 root@example.com

Host 10.40.45.104
  ForwardAgent yes
  User root
  ProxyCommand ssh -W %h:%p -p 44058 root@example.com
其中
10.40.*
是内部IP