istio.io/istio@v0.0.0-20240520182934-d79c90f27776/samples/custom-bootstrap/README.md (about)

     1  # Custom Envoy Bootstrap Configuration
     2  
     3  This sample creates a simple helloworld service that bootstraps the Envoy proxy with a custom configuration file.
     4  
     5  ## Starting the service
     6  
     7  First, we need to create a `ConfigMap` resource with our bootstrap configuration.
     8  
     9  ```bash
    10  kubectl apply -f custom-bootstrap.yaml
    11  ```
    12  
    13  Next, we can create a service that uses this bootstrap configuration.
    14  
    15  To do this, we need to add an annotation, `sidecar.istio.io/bootstrapOverride`, with the name of our ConfigMap as the value.
    16  
    17  We can create our helloworld app, using the custom config, with:
    18  
    19  ```bash
    20  kubectl apply -f example-app.yaml
    21  ```
    22  
    23  If you don't have [automatic sidecar injection](https://istio.io/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection)
    24  set in your cluster you will need to manually inject it to the services instead:
    25  
    26  ```bash
    27  istioctl kube-inject -f example-app.yaml -o example-app-istio.yaml
    28  kubectl apply -f example-app-istio.yaml
    29  ```
    30  
    31  ## Checking the Bootstrap Configuration
    32  
    33  To see what bootstrap configuration a pod is using:
    34  
    35  ```bash
    36  istioctl proxy-config bootstrap <POD-NAME>
    37  ```
    38  
    39  ## Customizing the Bootstrap
    40  
    41  The configuration provided will be passed to envoy using the [`--config-yaml`](https://www.envoyproxy.io/docs/envoy/v1.7.1/operations/cli#cmdoption-config-yaml) flag.
    42  
    43  This will merge the passed in configuration with the default configuration. Singular values will replace the default values, while repeated values will be appended.
    44  
    45  For reference, [the default bootstrap configuration](../../tools/packaging/common/envoy_bootstrap.json) and Envoy's [configuration reference](https://www.envoyproxy.io/docs/envoy/latest/configuration/configuration#config) may be useful
    46  
    47  ## Outside of Kubernetes
    48  
    49  The annotation above configures a volume mount and configures Istio to use it.
    50  When running outside of Kubernetes or in custom setups, similar functionality can be achieved by setting the `ISTIO_BOOTSTRAP_OVERRIDE` variable pointing to a file containing the custom bootstrap.
    51  
    52  ## Cleanup
    53  
    54  ```bash
    55  kubectl delete -f custom-bootstrap.yaml
    56  kubectl delete -f example-app.yaml
    57  ```