|
| 1 | +--- |
| 2 | +title: "{{site.mesh_product_name}} CLI tools" |
| 3 | +description: Reference for the CLI tools included in {{site.mesh_product_name}}, including usage examples and commands for kumactl, kuma-cp, and kuma-dp. |
| 4 | +content_type: reference |
| 5 | +layout: reference |
| 6 | +products: |
| 7 | + - mesh |
| 8 | +breadcrumbs: |
| 9 | + - /mesh/ |
| 10 | + |
| 11 | +works_on: |
| 12 | + - on-prem |
| 13 | + - konnect |
| 14 | + |
| 15 | +related_resources: |
| 16 | + - text: 'kuma-cp configuration reference' |
| 17 | + url: '/mesh/reference/kuma-cp/' |
| 18 | + - text: Mesh observability |
| 19 | + url: '/mesh/observability/' |
| 20 | + - text: "{{site.mesh_product_name}} Policy Hub" |
| 21 | + url: /mesh/policies/ |
| 22 | +--- |
| 23 | + |
| 24 | +{{site.mesh_product_name}} ships in a bundle that includes a few executables: |
| 25 | + |
| 26 | +* `kuma-cp`: The main {{site.mesh_product_name}} executable that runs the control plane. |
| 27 | +* `kuma-dp`: The {{site.mesh_product_name}} data plane proxy executable that invokes `envoy`. |
| 28 | +* `envoy`: The [Envoy](https://www.envoyproxy.io/) executable that we bundle into the archive for convenience. |
| 29 | +* `kumactl`: The user CLI to interact with {{site.mesh_product_name}} (`kuma-cp`) and its data. |
| 30 | +* `kuma-tcp-echo`: A sample application that echoes back the requests we make, used for demo purposes. |
| 31 | + |
| 32 | +You can learn how to use each executable by running it with the `-h` flag: |
| 33 | + |
| 34 | +```sh |
| 35 | +kuma-cp -h |
| 36 | +``` |
| 37 | + |
| 38 | +You can check their versions by running the `version [--detailed]` command: |
| 39 | + |
| 40 | +```sh |
| 41 | +kuma-cp version --detailed |
| 42 | +``` |
| 43 | + |
| 44 | +## kumactl |
| 45 | + |
| 46 | +The `kumactl` executable is your primary CLI tool for managing {{site.mesh_product_name}}. It allows you to: |
| 47 | + |
| 48 | +* Retrieve the state of {{site.mesh_product_name}} and the configured [policies](/mesh/policies-introduction/) in every environment. |
| 49 | +* Change the state of {{site.mesh_product_name}} by applying new policies with the `kumactl apply [..]` command. |
| 50 | + {:.info} |
| 51 | + > This is only possible on Universal. On Kubernetes, `kumactl` is read-only. You can change the state of {{site.mesh_product_name}} by leveraging its CRDs. |
| 52 | +* Install {{site.mesh_product_name}} on Kubernetes, and configure the PostgreSQL schema on Universal (`kumactl install [..]`). |
| 53 | + |
| 54 | +{:.info} |
| 55 | +The `kumactl` application is a CLI client for the underlying {{site.mesh_product_name}} HTTP API. Therefore, you can access the state of {{site.mesh_product_name}} by leveraging with the API directly. On Universal, you can also make changes via the HTTP API, while on Kubernetes the HTTP API is read-only. |
| 56 | + |
| 57 | + |
| 58 | +### kumactl commands |
| 59 | +The following commands are available on `kumactl`: |
| 60 | + |
| 61 | +* `kumactl install [..]`: Provides helpers to install {{site.mesh_product_name}} components in Kubernetes. |
| 62 | + * `kumactl install control-plane`: Installs {{site.mesh_product_name}} in Kubernetes in a `{{site.mesh_namespace}}` namespace. |
| 63 | + * `kumactl install observability`: Installs an observability (metrics, logging, tracing) backend in a Kubernetes cluster (Prometheus, Grafana, Loki, Jaeger, and Zipkin) in the `mesh-observability` namespace. |
| 64 | +* `kumactl config [..]`: Configures the local or zone control planes that `kumactl` should talk to. You can have more than one enabled, and the configuration will be stored in `~/.kumactl/config`. |
| 65 | +* `kumactl apply [..]`: Changes the state of {{site.mesh_product_name}}. Only available on Universal. |
| 66 | +* `kumactl get [..]`: Retrieves the raw state of {{site.mesh_product_name}} entities. |
| 67 | +* `kumactl inspect [..]`: Retrieves an augmented state of {{site.mesh_product_name}} entities. |
| 68 | +* `kumactl generate dataplane-token`: Generates a [data plane token](/mesh/dp-auth/#data-plane-proxy-token). |
| 69 | +* `kumactl generate tls-certificate`: Generates a TLS certificate for the client or server. |
| 70 | +* `kumactl manage ca [..]`: Manages certificate authorities. |
| 71 | +* `kumactl help [..]`: Explains the commands available. |
| 72 | +* `kumactl version [--detailed]`: Shows the version of the program. |
| 73 | + |
| 74 | +You can use `kumactl [cmd] --help` for documentation. |
| 75 | + |
| 76 | +### Using variables |
| 77 | + |
| 78 | +When using `kumactl apply`, you can specify variables to use your YAML as a template. |
| 79 | +This is useful for configuring policies and specifying values at runtime. |
| 80 | + |
| 81 | +For example, using the following YAML snippet: |
| 82 | + |
| 83 | +```yaml |
| 84 | +type: Mesh |
| 85 | +name: default |
| 86 | +mtls: |
| 87 | + backends: |
| 88 | + - name: vault-1 |
| 89 | + type: {% raw %}{{ caType }}{% endraw %} |
| 90 | + dpCert: |
| 91 | + rotation: |
| 92 | + expiration: 10h |
| 93 | +``` |
| 94 | +
|
| 95 | +You can set the `caType` when applying the configuration: |
| 96 | + |
| 97 | +```sh |
| 98 | +kumactl apply -f ~/res/mesh.yaml -v caType=builtin |
| 99 | +``` |
| 100 | + |
| 101 | +This will create the following mesh: |
| 102 | + |
| 103 | +```yaml |
| 104 | +type: Mesh |
| 105 | +name: default |
| 106 | +mtls: |
| 107 | + backends: |
| 108 | + - name: vault-1 |
| 109 | + type: builtin |
| 110 | + dpCert: |
| 111 | + rotation: |
| 112 | + expiration: 10h |
| 113 | +``` |
| 114 | + |
| 115 | +### Configuration |
| 116 | + |
| 117 | +You can view the current configuration using `kumactl config view`. |
| 118 | + |
| 119 | +The configuration is stored in `$HOME/.kumactl/config`, which is created when you run `kumactl` for the first time. |
| 120 | +When you add a new control plane with `kumactl config control-planes add`, the config file is updated. |
| 121 | +To change the path of the config file, run `kumactl` with `--config-file /new-path/config`. |
0 commit comments