Cluster
The kubernetes_cluster
resource allows you to create immutable Kubernetes clusters running in Docker containers using K3s.
Image Caching
Kubernetes clusters do not share the local machines Docker image cache. Each node in a cluster has it's own unqiue cache.
To save bandwidth all containers launched in the Kubernetes cluster pulled through an image cache that runs in Docker. After the first pull all images are subsequently pulled from the image cache not the public internet. This cache is global to all Nomad and Kubernetes clusters created with Jumppad.
For more information on the image cache see the container_registry
resource.
Attributes
Attributes are the properties of a resource that can be used to configure it.
Attach to the correct network // only when Image is specified
Network attaches the container to an existing network defined in a separate stanza. This block can be specified multiple times to attach the container to multiple networks.
Image defines a Docker image to use when creating the container. By default the kubernetes cluster resource will be created using the latest Jumppad container image.
Nodes nodes
int
The number of nodes to create in the cluster.
Additional volume to mount to the server and client nodes.
Docker image in the local Docker image cache to copy to the cluster on creation. This image is added to the Kubernetes clients docker cache enabling jobs to use images that may not be in the local registry.
Jumppad tracks changes to copied images, should the image change running jumppad up would push any changes to the cluster automatically.
A `port` stanza allows you to expose container ports on the local network or host. This stanza can be specified multiple times.
A `port_range` stanza allows you to expose a range of container ports on the local network or host. This stanza can be specified multiple times.
The following example would create 11 ports from 80 to 90 (inclusive) and expose them to the host machine.
Environment environment
map[string]string
environment variables to set when starting the container
An env stanza allows you to set environment variables in the container. This stanza can be specified multiple times.
Specifies the configuration for the Kubernetes cluster.
APIPort api_port
int
Port to expose the Kubernetes API on the host. By default this uses the standard api port `443`; however, if you are running multiple kubernetes instances you will need to override this value.
ContainerName container_name
string
The fully qualified resource name for the Kubernetes cluster, this value can be used to address the server from the Docker network. It is also the name of the Docker container.
Computed Attributes
These attributes are computed when the config is parsed and applied, and are therefor only known at parsetime or runtime.
Meta ID meta.id
string
The full ID of the resource e.g. `resource.type.name`. This is computed from the full resource path:
Meta Type meta.type
string
The type of the resource. This taken from the type label of the resource definition.
Meta Name meta.name
string
The name of the resource. This taken from the name label of the resource definition.
KubeConfig kube_config
KubeConfig
Details for the Kubenetes config file that can be used to interact with the cluster.
ConnectorPort connector_port
int
The port where the Jumppad connector is exposed to the host, this property is requied by the ingress resource and is not generally needed when building blueprints.
ExternalIP external_ip
string
Local IP address of the Nomad server, this property can be used to set the NOAMD_ADDR on the Jumppad client.
Examples
Simple cluster
Full Example
Last updated