Kubernetes Configuration k8s_config
The k8s_config resource allows Kubernetes configuraton to be applied to a
k8s_cluster
.
You can specify a list of paths or individual files and health checks for
the resources. A k8s_config
only completes once the configuration has been
successfully applied and any health checks have passed. This allows you to
create complex dependencies for your applications.
Jumppad monitors changes to the config defined in the paths
property and
automatically recreates this resource when jumppad up
is called.
Properties
- Name
cluster
- Type
- (nomad_cluster: )
- Required
- required
- Readonly
- Description
The reference to a cluster to apply the jobs to. Kubernetes config is only applied when the referenced cluster is created and healthy.
resource "nomad_job" "example" { cluster = resource.nomad_cluster.dev ... }
- Name
paths
- Type
- ([]string: [])
- Required
- required
- Readonly
- Description
Paths to the Nomad job files to apply to the cluster.
- Name
health_check
- Type
- (health_check: {})
- Required
- Readonly
- Description
Optional health check to perform after the jobs have been applied, this resource will not complete until the health checks are passing.
- Name
wait_until_ready
- Type
- (bool: )
- Required
- required
- Readonly
- Description
Determines if the resource waits until all config defined in the paths has been accepted and started by the server. If set to false the resource returns immediately after submitting the job.
health_check
A health_check stanza allows the definition of a health check which must pass before the resource is marked as successfully created.
health_check {
timeout = "60s"
pods = [
"component=server,app=consul",
"component=client,app=consul"
]
}
- Name
timeout
- Type
- (duration: )
- Required
- required
- Readonly
- Description
The maximum duration to wait before marking the health check as failed. Expressed as a Go duration, e.g.
1s
= 1 second,100ms
= 100 milliseconds.
- Name
pods
- Type
- ([]string: [])
- Required
- required
- Readonly
- Description
An array of kubernetes selector syntax. The healthcheck ensures that all containers defined by the selector are running before passing the healthcheck.
Meta Properties
In addition to the main properties, all resources have meta
properties, such
as the id
of the resource. To see the list of these properties please see the
Meta Properties
section in the documentation /docs/resources/meta.
Examples
resource "k8s_config" "app" {
cluster = resource.k8s_cluster.k3s
paths = [
"./k8s_config/app",
"./k8s_config/dashboard",
]
wait_until_ready = true
}