【发布时间】:2019-11-01 03:38:40
【问题描述】:
我在 Stratoscale 的 Symphony 中有一个 K8S 集群(运行 Linux)。它有一个由 Symphony 分配的集群 IP 地址 IP1。我已经在集群中安装了 Consul。我能够将 Consul KV 密钥“放入”一个 pod(通过 pod 网页上提供的命令行界面)并从另一个 pod 中“获取”它。就端口而言,名为“consul-consul-server”的 K8S Consul 服务具有此规范:
{
"kind": "Service",
"metadata": {
"name": "consul-consul-server",
"namespace": "consul",
...
},
"spec": {
"ports": [
{
"name": "http",
"protocol": "TCP",
"port": 8500,
"targetPort": 8500,
"nodePort": 30323
},
{
"name": "serflan-tcp",
"protocol": "TCP",
"port": 8301,
"targetPort": 8301,
"nodePort": 31056
},
{
"name": "serflan-udp",
"protocol": "UDP",
"port": 8301,
"targetPort": 8301,
"nodePort": 31056
},
{
"name": "serfwan-tcp",
"protocol": "TCP",
"port": 8302,
"targetPort": 8302,
"nodePort": 30717
},
{
"name": "serfwan-udp",
"protocol": "UDP",
"port": 8302,
"targetPort": 8302,
"nodePort": 30717
},
{
"name": "server",
"protocol": "TCP",
"port": 8300,
"targetPort": 8300,
"nodePort": 32091
},
{
"name": "dns-tcp",
"protocol": "TCP",
"port": 8600,
"targetPort": "dns-tcp",
"nodePort": 31688
},
{
"name": "dns-udp",
"protocol": "UDP",
"port": 8600,
"targetPort": "dns-udp",
"nodePort": 31688
}
],
"selector": {
"app": "consul",
"component": "server",
"release": "consul"
},
"clusterIP": "10.104.86.253",
"type": "NodePort",
"externalTrafficPolicy": "Cluster",
},
"status": {
"loadBalancer": {}
}
}
如何从集群外部的命令行启动 Consul 客户端代理?根据我在https://www.consul.io/docs/agent/cloud-auto-join.html#kubernetes-k8s- 中读到的内容,我尝试了以下方法:
consul agent -retry-join "provider=k8s namespace=consul label_selector=\"app=consul,component=server\" host_network=true" -client=
还有其他一些组合,但它们都会导致此错误:
==> Starting Consul agent...
==> Error starting agent: 2 errors occurred:
* listen udp 161.92.250.34:8600: bind: The requested address is not valid in its context.
* listen tcp 161.92.250.34:8600: bind: The requested address is not valid in its context.
知道我做错了什么吗?提前致谢。
【问题讨论】:
标签: kubernetes consul