istio - using annotation

In istio there are many annotation that we can use. In order to use this, we need to ensure that we have enable sidecar injection to our namespace. Otherwise annotation just won't work. I think this is what caught many ppl by surprise. 

Let's label our namespace test

kubectl label namespace test istio-injection=enabled

Next, let's do a simple deployment to prevent our workload from being injected with sidecar with "sidecar.istio.io/inject" = false.  When we deploy this yaml, you can be sure our workload will not have a sidecar. 

apiVersion: v1
kind: ServiceAccount
metadata:
  name: httpbin
---
apiVersion: v1
kind: Service
metadata:
  name: httpbin
  labels:
    app: httpbin
    service: httpbin
spec:
  ports:
  - name: http
    port: 8000
    targetPort: 8080
  selector:
    app: httpbin
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: httpbin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: httpbin
      version: v1
  template:
    metadata:
      labels:
        app: httpbin
        version: v1
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      serviceAccountName: httpbin
      containers:
      - image: docker.io/mccutchen/go-httpbin:v2.15.0
        imagePullPolicy: IfNotPresent
        name: httpbin
        ports:
        - containerPort: 8080

 Sample output 





Comments

Popular posts from this blog

gemini cli getting file not defined error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

vllm : Failed to infer device type