## kubernetes (platform)

Deploy the application into a Kubernetes cluster using Deployment objects.

### Interface

### Examples

```hcl
use "kubernetes" {
	image_secret = "registry_secret"
	replicas = 3
	probe_path = "/_healthz"
}
```

### Required Parameters

These parameters are used in the [`use` stanza](/docs/waypoint-hcl/use) for this plugin.

#### pod (category)

The configuration for a pod.

Pod describes the configuration for a pod when deploying.

##### pod.container (category)

Container describes the commands and arguments for a container config.

###### pod.container.args

An array of string arguments to pass through to the container.

- Type: **list of string**
- **Optional**

###### pod.container.command

An array of strings to run for the container.

- Type: **list of string**
- **Optional**

###### pod.container.cpu (category)

Cpu resource configuration.

CPU lets you define resource limits and requests for a container in a deployment.

###### pod.container.cpu.limit

Maximum amount of cpu to give the container. Supports m to indicate milli-cores.

- Type: **string**
- **Optional**

###### pod.container.cpu.request

How much cpu to give the container in cpu cores. Supports m to indicate milli-cores.

- Type: **string**
- **Optional**

###### pod.container.memory (category)

Memory resource configuration.

Memory lets you define resource limits and requests for a container in a deployment.

###### pod.container.memory.limit

Maximum amount of memory to give the container. Supports k for kilobytes, m for megabytes, and g for gigabytes.

- Type: **string**
- **Optional**

###### pod.container.memory.request

How much memory to give the container in bytes. Supports k for kilobytes, m for megabytes, and g for gigabytes.

- Type: **string**
- **Optional**

###### pod.container.name

Name of the container.

- Type: **string**
- **Optional**

###### pod.container.port (category)

A port and options that the application is listening on.

Used to define and expose multiple ports that the application or process is listening on for the container in use. Can be specified multiple times for many ports.

###### pod.container.port.host_ip

What host IP to bind the external port to.

- Type: **string**
- **Optional**

###### pod.container.port.host_port

The corresponding worker node port.

Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.

- Type: **uint**
- **Optional**

###### pod.container.port.name

Name of the port.

If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.

- Type: **string**

###### pod.container.port.port

The port number.

Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.

- Type: **uint**

###### pod.container.port.protocol

Protocol for port. Must be UDP, TCP, or SCTP.

- Type: **string**
- **Optional**
- Default: TCP

###### pod.container.probe (category)

Configuration to control liveness and readiness probes.

Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.

###### pod.container.probe.failure_threshold

Number of times a liveness probe can fail before the container is killed.

FailureThreshold \* TimeoutSeconds should be long enough to cover your worst case startup times.

- Type: **uint**
- **Optional**
- Default: 5

###### pod.container.probe.initial_delay

Time in seconds to wait before performing the initial liveness and readiness probes.

- Type: **uint**
- **Optional**
- Default: 5

###### pod.container.probe.timeout

Time in seconds before the probe fails.

- Type: **uint**
- **Optional**
- Default: 5

###### pod.container.probe_path

The HTTP path to request to test that the application is running.

Without this, the test will simply be that the application has bound to the port.

- Type: **string**
- **Optional**

###### pod.container.resources

A map of resource limits and requests to apply to a container on deploy.

Resource limits and requests for a container. This exists to allow any possible resources. For cpu and memory, use those relevant settings instead. Keys must start with either `limits_` or `requests_`. Any other options will be ignored.

- Type: **map of string to string**
- **Optional**

###### pod.container.static_environment

Environment variables to control broad modes of the application.

Environment variables that are meant to configure the container in a static way. This might be control an image that has multiple modes of operation, selected via environment variable. Most configuration should use the waypoint config commands.

- Type: **map of string to string**
- **Optional**

##### pod.security_context (category)

Holds pod-level security attributes and container settings.

###### pod.security_context.fs_group

A special supplemental group that applies to all containers in a pod.

- Type: **int64**

###### pod.security_context.run_as_non_root

Indicates that the container must run as a non-root user.

- Type: **bool**

###### pod.security_context.run_as_user

The UID to run the entrypoint of the container process.

- Type: **int64**

##### pod.sidecar (category)

A sidecar container within the same pod.

Another container to run alongside the app container in the kubernetes pod. Can be specified multiple times for multiple sidecars.

###### pod.sidecar.container (category)

Container describes the commands and arguments for a container config.

###### pod.sidecar.container.args

An array of string arguments to pass through to the container.

- Type: **list of string**
- **Optional**

###### pod.sidecar.container.command

An array of strings to run for the container.

- Type: **list of string**
- **Optional**

###### pod.sidecar.container.cpu (category)

Cpu resource configuration.

CPU lets you define resource limits and requests for a container in a deployment.

###### pod.sidecar.container.cpu.limit

Maximum amount of cpu to give the container. Supports m to indicate milli-cores.

- Type: **string**
- **Optional**

###### pod.sidecar.container.cpu.request

How much cpu to give the container in cpu cores. Supports m to indicate milli-cores.

- Type: **string**
- **Optional**

###### pod.sidecar.container.memory (category)

Memory resource configuration.

Memory lets you define resource limits and requests for a container in a deployment.

###### pod.sidecar.container.memory.limit

Maximum amount of memory to give the container. Supports k for kilobytes, m for megabytes, and g for gigabytes.

- Type: **string**
- **Optional**

###### pod.sidecar.container.memory.request

How much memory to give the container in bytes. Supports k for kilobytes, m for megabytes, and g for gigabytes.

- Type: **string**
- **Optional**

###### pod.sidecar.container.name

Name of the container.

- Type: **string**
- **Optional**

###### pod.sidecar.container.port (category)

A port and options that the application is listening on.

Used to define and expose multiple ports that the application or process is listening on for the container in use. Can be specified multiple times for many ports.

###### pod.sidecar.container.port.host_ip

What host IP to bind the external port to.

- Type: **string**
- **Optional**

###### pod.sidecar.container.port.host_port

The corresponding worker node port.

Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.

- Type: **uint**
- **Optional**

###### pod.sidecar.container.port.name

Name of the port.

If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.

- Type: **string**

###### pod.sidecar.container.port.port

The port number.

Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.

- Type: **uint**

###### pod.sidecar.container.port.protocol

Protocol for port. Must be UDP, TCP, or SCTP.

- Type: **string**
- **Optional**
- Default: TCP

###### pod.sidecar.container.probe (category)

Configuration to control liveness and readiness probes.

Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.

###### pod.sidecar.container.probe.failure_threshold

Number of times a liveness probe can fail before the container is killed.

FailureThreshold \* TimeoutSeconds should be long enough to cover your worst case startup times.

- Type: **uint**
- **Optional**
- Default: 5

###### pod.sidecar.container.probe.initial_delay

Time in seconds to wait before performing the initial liveness and readiness probes.

- Type: **uint**
- **Optional**
- Default: 5

###### pod.sidecar.container.probe.timeout

Time in seconds before the probe fails.

- Type: **uint**
- **Optional**
- Default: 5

###### pod.sidecar.container.probe_path

The HTTP path to request to test that the application is running.

Without this, the test will simply be that the application has bound to the port.

- Type: **string**
- **Optional**

###### pod.sidecar.container.resources

A map of resource limits and requests to apply to a container on deploy.

Resource limits and requests for a container. This exists to allow any possible resources. For cpu and memory, use those relevant settings instead. Keys must start with either `limits_` or `requests_`. Any other options will be ignored.

- Type: **map of string to string**
- **Optional**

###### pod.sidecar.container.static_environment

Environment variables to control broad modes of the application.

Environment variables that are meant to configure the container in a static way. This might be control an image that has multiple modes of operation, selected via environment variable. Most configuration should use the waypoint config commands.

- Type: **map of string to string**
- **Optional**

###### pod.sidecar.image

Image of the sidecar container.

- Type: **string**

### Optional Parameters

These parameters are used in the [`use` stanza](/docs/waypoint-hcl/use) for this plugin.

#### annotations

Annotations to be added to the application pod.

Annotations are added to the pod spec of the deployed application. This is useful when using mutating webhook admission controllers to further process pod events.

- Type: **map of string to string**
- **Optional**

#### autoscale (category)

Sets up a horizontal pod autoscaler to scale deployments automatically.

This configuration will automatically set up and associate the current deployment with a horizontal pod autoscaler in Kuberentes. Note that for this to work, you must also define resource limits and requests for a deployment otherwise the metrics-server will not be able to properly determine a deployments target CPU utilization.

##### autoscale.cpu_percent

The target CPU percent utilization before the horizontal pod autoscaler scales up a deployments replicas.

- Type: **int32**
- **Optional**

##### autoscale.max_replicas

The maximum amount of pods to scale to for a deployment.

- Type: **int32**
- **Optional**

##### autoscale.min_replicas

The minimum amount of pods to have for a deployment.

- Type: **int32**
- **Optional**

#### context

The kubectl context to use, as defined in the kubeconfig file.

- Type: **string**
- **Optional**

#### cpu (category)

Cpu resource configuration.

CPU lets you define resource limits and requests for a container in a deployment.

##### cpu.limit

Maximum amount of cpu to give the container. Supports m to indicate milli-cores.

- Type: **string**
- **Optional**

##### cpu.request

How much cpu to give the container in cpu cores. Supports m to indicate milli-cores.

- Type: **string**
- **Optional**

#### image_secret

Name of the Kubernetes secrete to use for the image.

This references an existing secret, waypoint does not create this secret.

- Type: **string**
- **Optional**

#### kubeconfig

Path to the kubeconfig file to use.

By default uses from current user's home directory.

- Type: **string**
- **Optional**
- Environment Variable: **KUBECONFIG**

#### labels

A map of key value labels to apply to the deployment pod.

- Type: **map of string to string**
- **Optional**

#### memory (category)

Memory resource configuration.

Memory lets you define resource limits and requests for a container in a deployment.

##### memory.limit

Maximum amount of memory to give the container. Supports k for kilobytes, m for megabytes, and g for gigabytes.

- Type: **string**
- **Optional**

##### memory.request

How much memory to give the container in bytes. Supports k for kilobytes, m for megabytes, and g for gigabytes.

- Type: **string**
- **Optional**

#### namespace

Namespace to target deployment into.

Namespace is the name of the Kubernetes namespace to apply the deployment in. This is useful to create deployments in non-default namespaces without creating kubeconfig contexts for each.

- Type: **string**
- **Optional**

#### probe (category)

Configuration to control liveness and readiness probes.

Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.

##### probe.failure_threshold

Number of times a liveness probe can fail before the container is killed.

FailureThreshold \* TimeoutSeconds should be long enough to cover your worst case startup times.

- Type: **uint**
- **Optional**
- Default: 30

##### probe.initial_delay

Time in seconds to wait before performing the initial liveness and readiness probes.

- Type: **uint**
- **Optional**
- Default: 5

##### probe.timeout

Time in seconds before the probe fails.

- Type: **uint**
- **Optional**
- Default: 5

#### probe_path

The HTTP path to request to test that the application is running.

Without this, the test will simply be that the application has bound to the port.

- Type: **string**
- **Optional**

#### replicas

The number of replicas to maintain.

If the replica count is maintained outside waypoint, for instance by a pod autoscaler, do not set this variable.

- Type: **int32**
- **Optional**

#### resources

A map of resource limits and requests to apply to a container on deploy.

Resource limits and requests for a container. This exists to allow any possible resources. For cpu and memory, use those relevant settings instead. Keys must start with either `limits_` or `requests_`. Any other options will be ignored.

- Type: **map of string to string**
- **Optional**

#### scratch_path

A path for the service to store temporary data.

A path to a directory that will be created for the service to store temporary data using tmpfs.

- Type: **list of string**
- **Optional**

#### service_account

Service account name to be added to the application pod.

Service account is the name of the Kubernetes service account to add to the pod. This is useful to apply Kubernetes RBAC to the application.

- Type: **string**
- **Optional**

#### service_port

The TCP port that the application is listening on.

By default, this config variable is used for exposing a single port for the container in use. For multi-port configuration, use 'ports' instead.

- Type: **uint**
- **Optional**
- Default: 3000

#### static_environment

Environment variables to control broad modes of the application.

Environment variables that are meant to configure the container in a static way. This might be control an image that has multiple modes of operation, selected via environment variable. Most configuration should use the waypoint config commands.

- Type: **map of string to string**
- **Optional**

### Output Attributes

Output attributes can be used in your `waypoint.hcl` as [variables](/docs/waypoint-hcl/variables) via [`artifact`](/docs/waypoint-hcl/variables/artifact) or [`deploy`](/docs/waypoint-hcl/variables/deploy).

#### id

- Type: **string**

#### name

- Type: **string**

#### resource_state

- Type: **opaqueany.Any**
