Kubernetes 自动加入Consul

SEP 19 2018 MITCHELL HASHIMOTO

We're releasing HashiCorp Consul + Kubernetes features every week.

This week we're showcasing the auto-join feature to enable nodes running inside and outside of Kubernetes to join a Consul cluster running on Kubernetes. Rather than joining with a static IP address or DNS entry, the auto-join feature uses the Kubernetes API to discover pods running Consul agents and joins those pods.

Video

To learn more about the Kubernetes auto-join provider for Consul, watch the video below or scroll down to read more. The video below shows a non-Kubernetes node automatically joining a Consul cluster running within Kubernetes.

http://v.youku.com/v_show/id_XMzgzMjc4MDIyNA==.html?spm=a2h3j.8428770.3416059.1

Auto-join for Kubernetes

Auto-join is a feature that enables Consul to use cloud or platform APIs for finding other Consul agents to join. This solves the problem of having to know the IP address of the initial set of agents to join a cluster. In the case of cloud APIs, hosts can often be tagged with specific values that Consul can use to filter hosts to find running Consul agents.

The Kubernetes auto-join provider uses the Kubernetes API to discover pods running Consul agents that can be joined. This feature can be used by agents both inside and outside of Kubernetes, but is particularly useful for agents running outside of Kubernetes because they cannot use standard Kubernetes service discovery to find the pods.

$ consul agent -retry-join 'provider=k8s label_selector="app=consul,component=server"'复制代码

The -retry-join flag above will cause the agent to query Kubernetes for pods labeled with app=consul,component=server and attempt to join those pods using the pod or host IP. If no pods are found, Consul will retry periodically.

Consul authenticates with Kubernetes using a standard kubeconfig file used for authenticating with kubectl. It automatically searches standard locations for this file. This allows the Kubernetes auto-join feature to work with all major hosted Kubernetes offerings.

The Kubernetes auto-join provider supports many configuration options. See the full reference documentation of available configuration options for more information.

Next

The Kubernetes auto-join provider is available in Consul 1.2.3 and later. To learn more, see the auto-join documentation.

We have more exciting Consul + Kubernetes integrations being released in the coming weeks. Please read the Consul and Kubernetes announcement blog post to learn more.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值