Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
    • Helm Chart
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log & Monitor
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
  • Toggle search form

[Istio] Explain MutatingWebhookConfiguration to auto-injected istio-proxy.

Posted on October 20, 2021November 5, 2021 By nim No Comments on [Istio] Explain MutatingWebhookConfiguration to auto-injected istio-proxy.
  1. MutatingWebhookConfiguration with namespaceSelector

Khi cái istio thì anh em sẽ biết là để auto inject sidecard Istio thì chúng ta cần add label cho namespace

Mặc định sẽ là:
kubectl label namespace default istio-injection=enabled

Nếu anh em sài revision cho istio và muốn inject istio theo revisio thì:
kubectl label namespace sample istio-injection- istio.io/rev=1-9-9

đôi khi là overwrite
kubectl label namespace sample istio-injection- istio.io/rev=1-9-9 --overwrite

Nếu bạn đang canary và tại 1 thời điểm có version trên istio của bạn

root@work-space-u20:~# ./istio-1.9.9/bin/istioctl version
client version: 1.9.9
istiod version: 1.9.9
pilot version: 1.9.8
data plane version: 1.9.9 (2 proxies), 1.9.8 (5 proxies)
Ở namespace default của mình đang có cả 2 label
vậy workload sẽ inject istio version nào
Thực hiện redeploy tất cả các workload ở ns default
Chúng vấn inject version cũ là 1.9.8 và khả năng là ăn theo label này: istio-injection=enabled

Hiện tại thì ở version 1.9.8 thì MutatingWebhookConfiguration là:

apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
  labels:
    app: sidecar-injector
    app.kubernetes.io/instance: istiod-primary-1.9.8
    install.operator.istio.io/owning-resource: unknown
    istio.io/rev: default
    operator.istio.io/component: Pilot
    release: istio
  name: istio-sidecar-injector
webhooks:
  - admissionReviewVersions:
      - v1beta1
      - v1
    clientConfig:
      caBundle: ''
      service:
        name: istiod
        namespace: istio-system
        path: /inject
        port: 443
    failurePolicy: Fail
    name: sidecar-injector.istio.io
    namespaceSelector:
      matchLabels:
        istio-injection: enabled
    objectSelector:
      matchExpressions:
        - key: sidecar.istio.io/inject
          operator: NotIn
          values:
            - 'false'
    rules:
      - apiGroups:
          - ''
        apiVersions:
          - v1
        operations:
          - CREATE
        resources:
          - pods
    sideEffects: None
Với config trên sẽ cho phép auto inject istio-proxy 1.9.8
Nếu namepace có label là istio-injection: enabled

ở version 1.9.9 thì MutatingWebhookConfiguration là:

apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
  labels:
    app: sidecar-injector
    app.kubernetes.io/instance: istio-canary-1.9.9
    install.operator.istio.io/owning-resource: unknown
    istio.io/rev: 1-9-9
    operator.istio.io/component: Pilot
    release: istio
  name: istio-sidecar-injector-1-9-9
webhooks:
  - admissionReviewVersions:
      - v1beta1
      - v1
    clientConfig:
      caBundle: ''
      service:
        name: istiod-1-9-9
        namespace: istio-system
        path: /inject
        port: 443
    failurePolicy: Fail
    name: sidecar-injector.istio.io
    namespaceSelector:
      matchExpressions:
        - key: istio-injection
          operator: DoesNotExist
        - key: istio.io/rev
          operator: In
          values:
            - 1-9-9
    objectSelector:
      matchExpressions:
        - key: sidecar.istio.io/inject
          operator: NotIn
          values:
            - 'false'
    rules:
      - apiGroups:
          - ''
        apiVersions:
          - v1
        operations:
          - CREATE
        resources:
          - pods
    sideEffects: None

Với config trên thì sẽ cho phép auto inject istio-proxy 1.9.9 nếu
không tồn tại key: istio-injection trong label namespace và trong namespace có label với key: istio.io/rev cộng với values: 1-9-9

https://serenafeng.github.io/2019/04/10/istio-sidecar-injector-overview/
từ links trên thì ta có 1 ví dụ nữa là:

......
webhooks:
- clientConfig:
    service:
      name: istio-sidecar-injector
      namespace: istio-system
      path: /inject
   ......
  namespaceSelector:
    matchExpressions:
    - key: name
      operator: NotIn
      values:
      - istio-system
    - key: istio-injection
      operator: NotIn
      values:
      - disabled
......

Trường hợp allow inject istio-proxy
– name of namespace khác isito-system và ko có label key:value là istio-injection: disabled

-> workload trong namespace là istio-system thì không được inject istio-system
-> workload trong namespace: default, sample,…(Not istio-system) và không cần namespace có label gì cả thì workload được inject istio-system

Isito-EnvoyFilter

Post navigation

Previous Post: [Grafana] Graph(old) – Hiện thị chart và table thông tin
Next Post: [Istio] Research tracing in Istio

More Related Articles

[Ingress-nginx/Istio] How do ingress-nginx work with istio smoothly. Reducing status 503 or 5xx. Isito-EnvoyFilter
[Istio/Recheck Envoy] Test các features liên quan đến EnvoyFilter trên Istio . Isito-EnvoyFilter
[Istio] Analyzing Istio Performance by pprof Isito-EnvoyFilter
[Istio] why does workload inject Istio that workload always connects fail database? – hold Application Isito-EnvoyFilter
[Istio-Multi Cluster] Tutorial is very detailed to install Primary-Remote on different networks Isito-EnvoyFilter
[VictoriaMetrics/Grafana/Prometheus/Kiali] VictoriaMetrics is a fast, cost-effective and scalable time series database Grafana

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Smartctl] Instruction check the health disk of Raspberry. January 16, 2023
  • [kubectl/Argocd] How to create a kubectl config file for serviceaccount or from the cluster secret of Argocd January 12, 2023
  • [Helm/Github] Create a public Helm chart repository with GitHub Pages January 8, 2023
  • [AWS] How to increase the disk size of a Windows EC2 machine? January 4, 2023
  • [Redis] ElastiCache-Redis Cross-Region Replication|Global DataStore January 3, 2023

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • Golang
    • Jquery & JavaScript
    • Laravel
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kubernetes
      • Ingress
    • Longhorn – Storage
    • Vault
    • VictoriaMetrics
  • Log & Monitor
    • ELK
      • Kibana
      • Logstash
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2023 NimTechnology.