喜大普奔: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.

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,186评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,858评论 3 387
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 158,620评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,888评论 1 285
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,009评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,149评论 1 291
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,204评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,956评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,385评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,698评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,863评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,544评论 4 335
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,185评论 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,899评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,141评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,684评论 2 362
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,750评论 2 351

推荐阅读更多精彩内容

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