bitnamicharts/consul
Bitnami Helm chart for HashiCorp Consul
100K+
HashiCorp Consul is a tool for discovering and configuring services in your infrastructure.
Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.
helm install my-release oci://registry-1.docker.io/bitnamicharts/consul
Looking to use HashiCorp Consul in production? Try VMware Tanzu Application Catalog, the commercial edition of the Bitnami catalog.
This chart bootstraps a HashiCorp Consul deployment on a Kubernetes cluster using the Helm package manager.
Bitnami charts can be used with Kubeapps for deployment and management of Helm Charts in clusters.
To install the chart with the release name my-release
:
helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/consul
Note: You need to substitute the placeholders
REGISTRY_NAME
andREPOSITORY_NAME
with a reference to your Helm chart registry and repository. For example, in the case of Bitnami, you need to useREGISTRY_NAME=registry-1.docker.io
andREPOSITORY_NAME=bitnamicharts
.
These commands deploy HashiCorp Consul on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.
Tip: List all releases using
helm list
Bitnami charts allow setting resource requests and limits for all containers inside the chart deployment. These are inside the resources
value (check parameter table). Setting requests is essential for production workloads and these should be adapted to your specific use case.
To make this process easier, the chart contains the resourcesPreset
values, which automatically sets the resources
section according to different presets. Check these presets in the bitnami/common chart. However, in production workloads using resourcesPreset
is discouraged as it may not fully adapt to your specific needs. Find more information on container resource management in the official Kubernetes documentation.
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
This chart can be integrated with Prometheus by setting metrics.enabled
to true
. This will deploy a sidecar container with consul_exporter in all pods and a metrics
service, which can be configured under the metrics.service
section. This metrics
service will have the necessary annotations to be automatically scraped by Prometheus.
Prometheus requirements
It is necessary to have a working installation of Prometheus or Prometheus Operator for the integration to work. Install the Bitnami Prometheus helm chart or the Bitnami Kube Prometheus helm chart to easily have a working Prometheus in your cluster.
Integration with Prometheus Operator
The chart can deploy ServiceMonitor
objects for integration with Prometheus Operator installations. To do so, set the value metrics.serviceMonitor.enabled=true
. Ensure that the Prometheus Operator CustomResourceDefinitions
are installed in the cluster or it will fail with the following error:
no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
Install the Bitnami Kube Prometheus helm chart for having the necessary CRDs and the Prometheus Operator.
This helm chart supports to customize the whole configuration file.
You can specify the Hashicorp Consul configuration using the configuration
parameter.
In addition to this option, you can also set an external ConfigMap with all the configuration files. This is done by setting the existingConfigmap
parameter. Note that this will override the previous option.
This chart provides support for Ingress resources. If you have an ingress controller installed on your cluster, such as nginx-ingress-controller or contour you can utilize the ingress controller to serve your application.
To enable ingress integration, please set ingress.enabled
to true
.
Hosts
Most likely you will only want to have one hostname that maps to this ASP.NET Core installation. If that's your case, the property ingress.hostname
will set it. However, it is possible to have more than one host. To facilitate this, the ingress.extraHosts
object can be specified as an array. You can also use ingress.extraTLS
to add the TLS configuration for extra hosts.
For each host indicated at ingress.extraHosts
, please indicate a name
, path
, and any annotations
that you may want the ingress controller to know about.
For annotations, please see this document. Not all annotations are supported by all ingress controllers, but this document does a good job of indicating which annotation is supported by many popular ingress controllers.
This chart will facilitate the creation of TLS secrets for use with the ingress controller, however, this is not required. There are three common use cases:
In the first two cases, one will need a certificate and a key. We would expect them to look like this:
-----BEGIN CERTIFICATE-----
MIID6TCCAtGgAwIBAgIJAIaCwivkeB5EMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV
...
jScrvkiBO65F46KioCL9h5tDvomdU1aqpI/CBzhvZn1c0ZTf87tGQR8NK7v7
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAvLYcyu8f3skuRyUgeeNpeDvYBCDcgq+LsWap6zbX5f8oLqp4
...
wrj2wDbCDCFmfqnSJ+dKI3vFLlEz44sAV8jX/kd4Y6ZTQhlLbYc=
-----END RSA PRIVATE KEY-----
If you are going to use Helm to manage the certificates, please copy these values into the certificate
and key
values for a given ingress.secrets
entry.
If you are going to manage TLS secrets outside of Helm, please know that you can create a TLS secret (named consul-ui.local-tls
for example).
Please see this example for more information.
Enable TLS encryption between servers
You must manually create a secret containing your PEM-encoded certificate authority, your PEM-encoded certificate, and your PEM-encoded private key.
Take into account that you will need to create a config map with the proper configuration.
If the secret is specified, the chart will locate those files at /opt/bitnami/consul/certs/
, so you will want to use the below snippet to configure HashiCorp Consul TLS encryption in your config map:
"ca_file": "/opt/bitnami/consul/certs/ca.pem",
"cert_file": "/opt/bitnami/consul/certs/consul.pem",
"key_file": "/opt/bitnami/consul/certs/consul-key.pem",
"verify_incoming": true,
"verify_outgoing": true,
"verify_server_hostname": true,
After creating the secret, you can install the helm chart specyfing the secret name using tlsEncryptionSecretName=consul-tls-encryption
.
The chart can optionally start a metrics exporter endpoint on port 9107
for prometheus. The data exposed by the endpoint is intended to be consumed by a prometheus chart deployed within the cluster and as such the endpoint is not exposed outside the cluster.
In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the extraEnvVars
property.
extraEnvVars:
- name: LOG_LEVEL
value: error
Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the .extraEnvVarsCM
or the extraEnvVarsSecret
properties.
This chart allows you to set your custom affinity using the affinity
parameter. Find more information about Pod's affinity in the kubernetes documentation.
As an alternative, you can use of the preset configurations for pod affinity, pod anti-affinity, and node affinity available at the bitnami/common chart. To do so, set the podAffinityPreset
, podAntiAffinityPreset
, or nodeAffinityPreset
parameters.
If you have a need for additional containers to run within the same pod as MongoDB®, you can do so via the sidecars
config parameter. Simply define your container according to the Kubernetes container spec.
sidecars:
- name: your-image-name
image: your-image
imagePullPolicy: Always
ports:
- name: portname
containerPort: 1234
Similarly, you can add extra init containers using the initContainers
parameter.
initContainers:
- name: your-image-name
image: your-image
imagePullPolicy: Always
ports:
- name: portname
containerPort: 1234
To back up and restore Helm chart deployments on Kubernetes, you need to back up the persistent volumes from the source deployment and attach them to a new deployment using Velero, a Kubernetes backup/restore tool. Find the instructions for using Velero in this guide.
The Bitnami HashiCorp Consul image stores the HashiCorp Consul data at the /bitnami
path of the container.
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube. See the Parameters section to configure the PVC or to disable persistence.
As the image run as non-root by default, it is necessary to adjust the ownership of the persistent volume so that the container can write data into it.
By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volume. However this feature does not work in all Kubernetes distributions. As an alternative, this chart supports using an initContainer to change the ownership of the volume before mounting it in the final destination.
You can enable this initContainer by setting volumePermissions.enabled
to true
.
Name | Description | Value |
---|---|---|
global.imageRegistry | Global Docker image registry | "" |
global.imagePullSecrets | Global Docker registry secret names as an array | [] |
global.defaultStorageClass | Global default StorageClass for Persistent Volume(s) | "" |
global.storageClass | DEPRECATED: use global.defaultStorageClass instead | "" |
global.security.allowInsecureImages | Allows skipping image verification | false |
global.compatibility.openshift.adaptSecurityContext | Adapt the securityContext sections of the deployment to make them compatible with Openshift restricted-v2 SCC: remove runAsUser, runAsGroup and fsGroup and let the platform use their allowed default IDs. Possible values: auto (apply if the detected running cluster is Openshift), force (perform the adaptation always), disabled (do not perform adaptation) | auto |
Name | Description | Value |
---|---|---|
kubeVersion | Override Kubernetes version | "" |
nameOverride | String to partially override common.names.fullname | "" |
fullnameOverride | String to fully override common.names.fullname | "" |
commonLabels | Labels to add to all deployed objects (sub-charts are not considered) | {} |
commonAnnotations | Annotations to add to all deployed objects (sub-charts are not considered) | {} |
clusterDomain | Kubernetes cluster domain name | cluster.local |
extraDeploy | Array of extra objects to deploy with the release | [] |
diagnosticMode.enabled | Enable diagnostic mode (all probes will be disabled and the command will be overridden) | false |
diagnosticMode.command | Command to override all containers in the deployment | ["sleep"] |
diagnosticMode.args | Args to override all containers in the deployment | ["infinity"] |
Name | Description | Value |
---|---|---|
image.registry | HashiCorp Consul image registry | REGISTRY_NAME |
image.repository | HashiCorp Consul image repository | REPOSITORY_NAME/consul |
image.digest | HashiCorp Consul image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | "" |
image.pullPolicy | HashiCorp Consul image pull policy | IfNotPresent |
image.pullSecrets | HashiCorp Consul image pull secrets | [] |
image.debug | Enable image debug mode | false |
datacenterName | Datacenter name for Consul. If not supplied, will use the Consul | dc1 |
domain | Consul domain name | consul |
raftMultiplier | Multiplier used to scale key Raft timing parameters | 1 |
gossipKey | Gossip key for all members. The key must be base64-encoded, can be generated with $(consul keygen) | "" |
tlsEncryptionSecretName | Name of existing secret with TLS encryption data | "" |
automountServiceAccountToken | Mount Service Account token in pod | false |
hostAliases | Deployment pod host aliases | [] |
configuration | HashiCorp Consul configuration to be injected as ConfigMap | "" |
existingConfigmap | ConfigMap with HashiCorp Consul configuration | "" |
localConfig | Extra configuration that will be added to the default one | "" |
podLabels | Pod labels | {} |
priorityClassName | Priority class assigned to the Pods | "" |
runtimeClassName | Name of the runtime class to be used by pod(s) | "" |
schedulerName | Alternative scheduler | "" |
terminationGracePeriodSeconds | In seconds, time the given to the Consul pod needs to terminate gracefully | "" |
topologySpreadConstraints | Topology Spread Constraints for pod assignment | [] |
command | Command for running the container (set to default if not set). Use array form | [] |
args | Args for running the container (set to default if not set). Use array form | [] |
extraEnvVars | Extra environment variables to be set on HashiCorp Consul container | [] |
extraEnvVarsCM | Name of existing ConfigMap containing extra env vars | "" |
extraEnvVarsSecret | Name of existing Secret containing extra env vars | "" |
containerPorts.http | Port to open for HTTP in Consul | 8500 |
containerPorts.dns | Port to open for DNS server in Consul | 8600 |
containerPorts.rpc | Port to open for RPC in Consul | 8400 |
containerPorts.rpcServer | Port to open for RPC Server in Consul | 8300 |
containerPorts.serfLAN | Port to open for Serf LAN in Consul | 8301 |
containerPorts.serfWAN | Port to open for Serf WAN in Consul | 8302 |
lifecycleHooks | Add lifecycle hooks to the deployment | {} |
Name | Description | Value |
---|---|---|
replicaCount | Number of HashiCorp Consul replicas to deploy |
Note: the README for this chart is longer than the DockerHub length limit of 25000, so it has been trimmed. The full README can be found at https://github.com/bitnami/charts/blob/main/bitnami/consul/README.md