From 4954396ffcb5fa1f14261eedd54cad08a60fb85c Mon Sep 17 00:00:00 2001 From: John Howard Date: Mon, 26 Jul 2021 07:06:27 -0700 Subject: [PATCH] Nest subsections under proper header for injection (#10114) * Nest subsections under proper header for injection These should be under auto injection, not manual injection * Update index.md --- .../sidecar-injection/index.md | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/content/en/docs/setup/additional-setup/sidecar-injection/index.md b/content/en/docs/setup/additional-setup/sidecar-injection/index.md index 88a1b7e039..f9204b0ce7 100644 --- a/content/en/docs/setup/additional-setup/sidecar-injection/index.md +++ b/content/en/docs/setup/additional-setup/sidecar-injection/index.md @@ -38,47 +38,6 @@ When you set the `istio-injection=enabled` label on a namespace and the injectio Note that unlike manual injection, automatic injection occurs at the pod-level. You won't see any change to the deployment itself. Instead, you'll want to check individual pods (via `kubectl describe`) to see the injected proxy. -### Manual sidecar injection - -To manually inject a deployment, use [`istioctl kube-inject`](/docs/reference/commands/istioctl/#istioctl-kube-inject): - -{{< text bash >}} -$ istioctl kube-inject -f @samples/sleep/sleep.yaml@ | kubectl apply -f - -serviceaccount/sleep created -service/sleep created -deployment.apps/sleep created -{{< /text >}} - -By default, this will use the in-cluster configuration. Alternatively, injection can be done using local copies of the configuration. - -{{< text bash >}} -$ kubectl -n istio-system get configmap istio-sidecar-injector -o=jsonpath='{.data.config}' > inject-config.yaml -$ kubectl -n istio-system get configmap istio-sidecar-injector -o=jsonpath='{.data.values}' > inject-values.yaml -$ kubectl -n istio-system get configmap istio -o=jsonpath='{.data.mesh}' > mesh-config.yaml -{{< /text >}} - -Run `kube-inject` over the input file and deploy. - -{{< text bash >}} -$ istioctl kube-inject \ - --injectConfigFile inject-config.yaml \ - --meshConfigFile mesh-config.yaml \ - --valuesFile inject-values.yaml \ - --filename @samples/sleep/sleep.yaml@ \ - | kubectl apply -f - -serviceaccount/sleep created -service/sleep created -deployment.apps/sleep created -{{< /text >}} - -Verify that the sidecar has been injected into the sleep pod with `2/2` under the READY column. - -{{< text bash >}} -$ kubectl get pod -l app=sleep -NAME READY STATUS RESTARTS AGE -sleep-64c6f57bc8-f5n4x 2/2 Running 0 24s -{{< /text >}} - #### Deploying an app Deploy sleep app. Verify both deployment and pod have a single container. @@ -176,6 +135,47 @@ The injector is configured with the following logic: 1. If either label is enabled, the pod is injected 1. If neither label is set, the pod is injected if `.values.sidecarInjectorWebhook.enableNamespacesByDefault` is enabled. This is not enabled by default, so generally this means the pod is not injected. +### Manual sidecar injection + +To manually inject a deployment, use [`istioctl kube-inject`](/docs/reference/commands/istioctl/#istioctl-kube-inject): + +{{< text bash >}} +$ istioctl kube-inject -f @samples/sleep/sleep.yaml@ | kubectl apply -f - +serviceaccount/sleep created +service/sleep created +deployment.apps/sleep created +{{< /text >}} + +By default, this will use the in-cluster configuration. Alternatively, injection can be done using local copies of the configuration. + +{{< text bash >}} +$ kubectl -n istio-system get configmap istio-sidecar-injector -o=jsonpath='{.data.config}' > inject-config.yaml +$ kubectl -n istio-system get configmap istio-sidecar-injector -o=jsonpath='{.data.values}' > inject-values.yaml +$ kubectl -n istio-system get configmap istio -o=jsonpath='{.data.mesh}' > mesh-config.yaml +{{< /text >}} + +Run `kube-inject` over the input file and deploy. + +{{< text bash >}} +$ istioctl kube-inject \ + --injectConfigFile inject-config.yaml \ + --meshConfigFile mesh-config.yaml \ + --valuesFile inject-values.yaml \ + --filename @samples/sleep/sleep.yaml@ \ + | kubectl apply -f - +serviceaccount/sleep created +service/sleep created +deployment.apps/sleep created +{{< /text >}} + +Verify that the sidecar has been injected into the sleep pod with `2/2` under the READY column. + +{{< text bash >}} +$ kubectl get pod -l app=sleep +NAME READY STATUS RESTARTS AGE +sleep-64c6f57bc8-f5n4x 2/2 Running 0 24s +{{< /text >}} + ## Customizing injection Generally, pod are injected based on the sidecar injection template, configured in the `istio-sidecar-injector` configmap.