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
  • Coding
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • Golang
    • Laravel
    • Jquery & JavaScript
    • Git
    • 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

[kiali/istio] Fix issue Configured: configmaps “istio” not found Isito-EnvoyFilter
[VictoriaMetrics/Grafana/Prometheus/Kiali] VictoriaMetrics is a fast, cost-effective and scalable time series database Grafana
[istio] Discover route inside istio Isito-EnvoyFilter
[Istio] Authenticator KubeJWTAuthenticator at index 1 got error: failed to validate the JWT from cluster – When you update K8s version 1.20 to 1.21 Isito-EnvoyFilter
[Istio] Research tracing in Istio Isito-EnvoyFilter
[Istio] Change resource request and limit (RAM-CPU) for components of Istio Isito-EnvoyFilter

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

  • Protected: My Assignment  June 24, 2022
  • [Spinnaker] Spinnaker writes too many logs – Reduce spinnaker log level June 22, 2022
  • [Jenkins] Jobs will be created automatically by Jenkins Job Builder June 20, 2022
  • [Postgresql] Install postgresql client and trying a few command postgresql. June 20, 2022
  • [Mount/Nextcloud] How do you mount a hard disk that was used windows into Linux. June 19, 2022

Archives

  • 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
    • Jenkins
    • Spinnaker
  • Coding
    • Git
    • Golang
    • Jquery & JavaScript
    • Laravel
    • 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 © 2022 NimTechnology.