喜大普奔:HashiCorp Consul 1.3:Envoy发布!

OCT 11 2018 MITCHELL HASHIMOTO

We are excited to announce the release of HashiCorp Consul 1.3. This release extends Consul to support Envoy as a proxy for Connect and enables automatic sidecar injection in Kubernetes for secure pod communication.

Connect enables secure service-to-service communication with automatic TLS encryption and identity-based authorization. Since the initial release of Connect in June, the Consul team has focused on hardening Connect in production and expanding platform integrations to enable a global service mesh. This release delivers major improvements in both categories: Envoy is a high-performance, feature-rich, and production hardened proxy for Connect. And the Kubernetes integrations enable automatic secure pod communications across services both in and out of Kubernetes.

Download Now

Configuring and Running Envoy

You can now define sidecars directly within an existing service definition and run Envoy with a single command. Consul automatically configures Envoy according to the service definition and runs Envoy. This command configures and executes envoy from your executable path.

$ consul connect envoy -sidecar-for=redis
...

Along with the local Consul agent, this is all that is necessary to run a sidecar proxy for any service on any platform. You don't need to run a multitude of related dependencies to use Connect. One Consul binary, one command, anywhere.

The redis service definition from the example above can now nest its associated sidecar. The sidecar service is itself a full service definition and can contain its own health checks, tags, and more. This is the same service definition model Consul users are familiar with. Sidecars are populated with reasonable defaults so many services will just have an empty sidecar definition.

service {
  name = "redis"
  port = 6379
  connect { sidecar_service {} }
}

The Envoy proxy also supports an advanced configuration option to pass arbitrary Envoy configuration. This can be used to manually configure features such as Layer 7 routing. We will be extending the support for more types of Envoy configuration later.

For development environments or systems that don't support Envoy, you can use the built-in proxy using a similarly simple command:

$ consul connect proxy -sidecar-for=redis
...

Connect supports heterogeneous proxy deployments: any two proxy implementations can communicate and any service instance can run any proxy implementation. This allows the operator to choose the correct proxy for the environment. We are working with partners to support more proxy solutions in the future.

Automatic Sidecars in Kubernetes

The Connect sidecar running Envoy can be automatically injected into pods in your Kubernetes cluster, making configuration for Kubernetes automatic.

For properly annotated pods, Envoy is automatically configured and started in the pod and can both accept and establish connections using Connect. This allows the pod to communicate with clients and dependencies exclusively over authorized and encrypted connections.

An example Redis server is shown below with Connect configured to accept inbound connections. Notice that the pod would still be fully functional without Connect. Minimal to zero modifications are required to pod specifications to enable Connect in Kubernetes.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
      annotations:
        "consul.hashicorp.com/connect-inject": "true"
    spec:
      containers:
        - name: redis
          image: "redis:4.0-alpine3.8"
          args: [ "--port", "6379" ]
          ports:
            - containerPort: 6379
              name: tcp

The next example deployment configures an open source Redis UI to connect to Redis via Connect. Notice that again only minimal modifications are necessary: the UI has to be configured to talk to a localhost port to connect through the proxy. The injector also injects environment variables into all containers to make this dynamic, such as REDIS_CONNECT_SERVICE_HOST and REDIS_CONNECT_SERVICE_PORT, though these aren't used in the example below.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis-ui
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis-ui
  template:
    metadata:
      labels:
        app: redis-ui
      annotations:
        "consul.hashicorp.com/connect-inject": "true"
        "consul.hashicorp.com/connect-service-upstreams": "redis:1234"
    spec:
      containers:
      - name: redis-ui
        image: rediscommander/redis-commander
        env:
        - name: REDIS_HOSTS
          value: "local:127.0.0.1:1234"
        - name: K8S_SIGTERM
          value: "1"
        ports:
        - name: http
          containerPort: 8081

The Kubernetes Connect injector can be run within Kubernetes using the Helm chart. It also requires that every client agent has gRPC enabled for the Envoy proxies.

connectInject:
  enabled: true

client:
  grpc: true

To learn more, please see the full reference documentation on Connect sidecar injection on Kubernetes.

Next

Consul 1.3 with Envoy support and the Connect injector are available immediately. Installing the Connect injector process with the official Helm chart requires version 0.3.0 or later of the Consul Helm chart. To learn more about these features, please see the resources listed below:

There are many more improvements planned for Consul in the coming months. We're improving Consul to support an easier to use and more expressive ACL system, powerful new UI features, simpler TLS configuration, and much more.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,921评论 0 10
  • 日子过得太安逸, 想着改变 想着行动起来 想着逃离安逸的生活 却怎么都坚持不下去 明明没有资本去享受 这安逸的生活...
    日子過得太安逸xue阅读 145评论 0 0
  • 突然有一天早上睡起来发现自己三十多了,在已经过去的三十多年里有很多故事想把它们记录下来,我害怕随着时间的流逝我会忘...
    㙓㙓阅读 421评论 0 0
  • 住云慢小居,赏枫林翠竹,闻鸡鸣鸟叫,观雾漫山林
    行摄在路上阅读 209评论 0 0
  • 1,基本上寒热虚实都可以灸,但是要针对不同人不同情况来决定灸量。从事工作类别、年龄、病情急慢大小、肌肉厚薄都是需要...
    李沙梨阅读 1,059评论 0 0

友情链接更多精彩内容