***

title: kube inject command reference
approved: 2025-05-30T00:00:00.000Z
max-toc-depth: 2
----------------

The `kube inject` command injects the Postman Insights Agent into a Kubernetes deployment and output the result on the command line into a file. See [Examples](#examples).

## Flags

* `-h`, `--help` - Help for `inject`.
* `--host-allow strings` - Allows only HTTP hosts matching regular expressions.
* `--host-exclusions strings` - Removes HTTP hosts matching regular expressions.
* `--interfaces strings` - List of network interfaces to listen on. Defaults to all interfaces on host.
* `-f, --file string` - Path to the Kubernetes YAML file to be injected. Expects to contain a valid deployment manifest. You can use `-` with the file name to read from standard input.
* `--path-allow strings` - Allows only HTTP paths matching regular expressions.
* `--path-exclusions strings` - Removes HTTP paths matching regular expressions.
* `--rate-limit float` - Number of requests per minute to capture.
* `--repro-mode` - Turns on Repro Mode to send request and response payloads to Postman.
* `-o, --output string` - Path to the output file. If not specified, the output prints to `stdout`.
* `-s, --secret string[="true"]` - Whether to generate a Kubernetes Secret. If set to `"true"`, the agent adds the secret to the modified Kubernetes YAML file. Specify a path to write the secret to a separate file. If this is done, an output file must also be specified with `--output`. Default: `"false"`.

## Global flags

* `--log-format string` - Set to `'color'`, `'plain'` or `'json'` to control the log format.
* `--project string` - Your Postman Insights project ID.
* `--proxy string` - The domain name, IP address, or URL of an HTTP proxy server to use.
* `--repro-mode` - Enable Repro Mode.

<Info class="iconless-callout">
  **Notes:**

  * The input file must be in YAML format and must contain at least one valid deployment manifest.

  * If the `--secret` flag is set to a file path, the `--output` flag must also be set.
</Info>

### Examples

* Inject the set of deployment manifests found in `resources.yml` and print the result to standard out. Each injected deployment will send traffic from the endpoint to the Postman Insights Agent.

  ```bash
  postman-insights-agent kube inject --project projectId -f resources.yml
  ```

* Inject any deployment manifests found in `resources.yml` similar to the previous run. Also generate and add any secrets required for the Insights Agent to run.

  ```bash
  postman-insights-agent kube inject -s --project projectId -f resources.yml
  ```

* Output injected resources and any secret manifests to separate files:

  ```bash
  postman-insights-agent kube inject -s="secret.yml" --project projectId -f in.yml -o out.yml
  ```

* Apply generated resources through pipe using `kubectl`:

  ```bash
  postman-insights-agent kube inject -s --project projectId -f in.yml | kubectl apply -f -
  ```
