Helm Chart Configuration
Configuration (Values)
The chart is highly customizable using Helm configuration values. Each value has a sane default tuned for an optimal getting started experience with Consul. Before going into production, please review the parameters below and consider if they’re appropriate for your deployment.
global - Holds values that affect multiple components of the chart.
enabled (
boolean: true
) - The master enabled/disabled setting. If true, servers, clients, Consul DNS and the Consul UI will be enabled. Each component can override this default via its component-specific “enabled” config. If false, no components will be installed by default and per-component opt-in is required, such as by setting server.enabled to true.name (
string: null
) - Set the prefix used for all resources in the Helm chart. If not set, the prefix will be<helm release name>-consul
.domain (
string: "consul"
) - The domain Consul will answer DNS queries for (see -domain) and the domain services synced from Consul into Kubernetes will have, e.g.service-name.service.consul
.image (
string: "consul:<latest version>"
) - The name (and tag) of the Consul Docker image for clients and servers. This can be overridden per component. This should be pinned to a specific version tag, otherwise you may inadvertently upgrade your Consul version.Examples:
# Consul 1.5.0
image: "consul:1.5.0"
# Consul Enterprise 1.5.0
image: "hashicorp/consul-enterprise:1.5.0-ent"
imagePullSecrets (
array<map>: [])
- Array of objects containing image pull secret names that will be applied to each service account. This can be used to reference image pull secrets if using a custom consul or consul-k8s Docker image. See Using A Private Registry for reference.imageK8S (
string: "hashicorp/consul-k8s:<latest version>"
) - The name (and tag) of the consul-k8s Docker image that is used for functionality such the catalog sync. This can be overridden per component.Note: support for the catalog sync’s liveness and readiness probes was added to consul-k8s 0.6.0. If using an older consul-k8s version, you may need to remove these checks to make sync work. If using mesh gateways and global.acls.manageSystemACLs then must be >= 0.9.0.
imageEnvoy (
string: "envoyproxy/envoy-alpine:<latest supported version>"
) - The default envoy image to use for ingress and terminating gateways.datacenter (
string: "dc1"
) - The name of the datacenter that the agents should register as. This can’t be changed once the Consul cluster is up and running since Consul doesn’t support an automatic way to change this value currently: https://github.com/hashicorp/consul/issues/1858.enablePodSecurityPolicies (
boolean: false
) - Controls whether pod security policies are created for the Consul components created by this chart. See https://kubernetes.io/docs/concepts/policy/pod-security-policy/.gossipEncryption - Configures which Kubernetes secret to retrieve Consul’s gossip encryption key from (see -encrypt). If secretName or secretKey are not set, gossip encryption will not be enabled. The secret must be in the same namespace that Consul is installed into.
The secret can be created by running:
$ kubectl create secret generic consul-gossip-encryption-key --from-literal=key=$(consul keygen)
# To reference, use:
# gossipEncryption:
# secretName: consul-gossip-encryption-key
# secretKey: key
secretName (
string: ""
) - The name of the Kubernetes secret that holds the gossip encryption key. The secret must be in the same namespace that Consul is installed into.secretKey (
string: ""
) - The key within the Kubernetes secret that holds the gossip encryption key.
enableConsulNamespaces (
boolean: false
)Enterprise
-
enableConsulNamespaces
indicates that you are running Consul Enterprise v1.7+ with a valid Consul Enterprise license and would like to make use of configuration beyond registering everything into thedefault
Consul namespace. Requires consul-k8s v0.12+. Additional configuration options are found in theconsulNamespaces
section of both the catalog sync and connect injector.bootstrapACLs (
boolean: false
) - [DEPRECATED] Useglobal.acls.manageSystemACLs
instead.acls - Configure ACLs.
manageSystemACLs (
boolean: false
) - If true, the Helm chart will automatically manage ACL tokens and policies for all Consul and consul-k8s components. This requires Consul >= 1.4 and consul-k8s >= 0.14.0.bootstrapToken - A Kubernetes secret containing the bootstrap token to use for creating policies and tokens for all Consul and consul-k8s components. If set, we will skip ACL bootstrapping of the servers and will only initialize ACLs for the Consul clients and consul-k8s system components. Requires consul-k8s >= 0.14.0.
secretName (
string: null
) - The name of the Kubernetes secret.secretKey (
string: null
) - The key of the Kubernetes secret.
createReplicationToken (
boolean: false
) - If true, an ACL token will be created that can be used in secondary datacenters for replication. This should only be set to true in the primary datacenter since the replication token must be created from that datacenter. In secondary datacenters, the secret needs to be imported from the primary datacenter and referenced viaglobal.acls.replicationToken
. Requires consul-k8s >= 0.13.0.replicationToken - replicationToken references a secret containing the replication ACL token. This token will be used by secondary datacenters to perform ACL replication and create ACL tokens and policies. This value is ignored if
bootstrapToken
is also set. Requires consul-k8s >= 0.13.0.secretName (
string: null
) - The name of the Kubernetes secret.secretKey (
string: null
) - The key of the Kubernetes secret.
federation - Configure federation.
enabled (
boolean: false
) - Experimental: Currently this is only available in Consul 1.8.0. If enabled, this datacenter will be federation-capable. Only federation via mesh gateways is supported. Mesh gateways and servers will be configured to allow federation. Requiresglobal.tls.enabled
,meshGateway.enabled
andconnectInject.enabled
to be true.createFederationSecret (
boolean: false
) - If true, the chart will create a Kubernetes secret that can be imported into secondary datacenters so they can federate with this datacenter. The secret contains all the information secondary datacenters need to contact and authenticate with this datacenter. This should only be set to true in your primary datacenter. The secret name is<global.name>-federation
(if settingglobal.name
), otherwise<helm-release-name>-consul-federation
. Requires consul-k8s 0.15.0+.
tls - Enables TLS encryption across the cluster to verify authenticity of the Consul servers and clients. Requires Consul v1.4.1+ and consul-k8s v0.16.2+
enabled (
boolean: false
) - If true, the Helm chart will enable TLS for Consul servers and clients and all consul-k8s components, as well as generate certificate authority (optional) and server and client certificates.enableAutoEncrypt (
boolean: false
) - If true, turns on the auto-encrypt feature on clients and servers. It also switches consul-k8s components to retrieve the CA from the servers via the API. Requires Consul 1.7.1+ and consul-k8s 0.13.0serverAdditionalDNSSANs (
array<string>: []
) - A list of additional DNS names to set as Subject Alternative Names (SANs) in the server certificate. This is useful when you need to access the Consul server(s) externally, for example, if you’re using the UI.serverAdditionalIPSANs (
array<string>: []
) - A list of additional IP addresses to set as Subject Alternative Names (SANs) in the server certificate. This is useful when you need to access the Consul server(s) externally, for example, if you’re using the UI.verify (
boolean: true
) - If true,verify_outgoing
,verify_server_hostname
, andverify_incoming_rpc
will be set totrue
for Consul servers and clients. Set this to false to incrementally roll out TLS on an existing Consul cluster. Please see Configuring TLS on an Existing Cluster for more details.httpsOnly (
boolean: true
) - If true, the Helm chart will configure Consul to disable the HTTP port on both clients and servers and to only accept HTTPS connections.caCert - A Kubernetes secret containing the certificate of the CA to use for TLS communication within the Consul cluster. If you have generated the CA yourself with the consul CLI, you could use the following command to create the secret in Kubernetes:
kubectl create secret generic consul-ca-cert \
--from-file='tls.crt=./consul-agent-ca.pem'
secretName (
string: null
) - The name of the Kubernetes secret.secretKey (
string: null
) - The key of the Kubernetes secret.
caKey - A Kubernetes secret containing the private key of the CA to use for TLS communication within the Consul cluster. If you have generated the CA yourself with the consul CLI, you could use the following command to create the secret in Kubernetes:
kubectl create secret generic consul-ca-key \
--from-file='tls.key=./consul-agent-ca-key.pem'
secretName (
string: null
) - The name of the Kubernetes secret.secretKey (
string: null
) - The key of the Kubernetes secret.
lifecycleSidecarContainer - The lifecycle sidecar ensures the Consul services are always registered with their local Consul clients and is used by the ingress/terminating/mesh gateways as well as with every Connect-injected service.
resources (
map
) - The resource requests and limits (CPU, memory, etc.) for each of the lifecycle sidecar containers. This should be a YAML map of a Kubernetes ResourceRequirements object. See values file for defaults.# Resources are defined as a YAML map:
resources:
requests:
memory: '25Mi'
cpu: '20m'
limits:
memory: '50Mi'
cpu: '20m'
openshift - Configuration for running this Helm chart on the Red Hat OpenShift platform. This Helm chart currently supports OpenShift v4.x+.
- enabled (
boolean: false
) - If true, the Helm chart will create necessary configuration for running its components on OpenShift.
- enabled (
server - Values that configure running a Consul server within Kubernetes.
enabled (
boolean: global.enabled
) - If true, the chart will install all the resources necessary for a Consul server cluster. If you’re running Consul externally and want agents within Kubernetes to join that cluster, this should probably be false.image (
string: global.image
) - The name of the Docker image (including any tag) for the containers running Consul server agents.replicas (
integer: 3
) -The number of server agents to run. This determines the fault tolerance of the cluster. Please see the deployment table for more information.bootstrapExpect (
integer: 3
) - For new clusters, this is the number of servers to wait for before performing the initial leader election and bootstrap of the cluster. This must be less than or equal toserver.replicas
. This value is only used when bootstrapping new clusters, it has no effect during ongoing cluster maintenance.-
Enterprise
- This value refers to a Kubernetes secret that you have created that contains your enterprise license. It is required if you are using an enterprise binary. Defining it here applies it to your cluster once a leader has been elected. If you are not using an enterprise image or if you plan to introduce the license key via another route, then set these fields to null.
secretName (
string: null
) - The name of the Kubernetes secret that holds the enterprise license. The secret must be in the same namespace that Consul is installed into.secretKey (
string: null
) - The key within the Kubernetes secret that holds the enterprise license.
storage (
string: 10Gi
) - This defines the disk size for configuring the servers’ StatefulSet storage. For dynamically provisioned storage classes, this is the desired size. For manually defined persistent volumes, this should be set to the disk size of the attached volume.storageClass (
string: null
) - The StorageClass to use for the servers’ StatefulSet storage. It must be able to be dynamically provisioned if you want the storage to be automatically created. For example, to use Local storage classes, the PersistentVolumeClaims would need to be manually created. Anull
value will use the Kubernetes cluster’s default StorageClass. If a default StorageClass does not exist, you will need to create one.connect (
boolean: true
) - This will enable/disable Connect. Setting this to true will not automatically secure pod communication, this setting will only enable usage of the feature. Consul will automatically initialize a new CA and set of certificates. Additional Connect settings can be configured by setting theserver.extraConfig
value.resources (
map
) - The resource requests (CPU, memory, etc.) for each of the server agents. This should be a YAML map corresponding to a Kubernetes ResourceRequirements object. NOTE: The use of a YAML string is deprecated. See values file for defaults.# Resources are defined as a YAML map:
resources:
requests:
memory: "10Gi"
limits:
memory: "10Gi"
updatePartition (
integer: 0
) - This value is used to carefully control a rolling update of Consul server agents. This value specifies the partition for performing a rolling update. Please read the linked Kubernetes documentation for more information.disruptionBudget - This configures the PodDisruptionBudget for the server cluster.
enabled (
boolean: true
) - This will enable/disable registering a PodDisruptionBudget for the server cluster. If this is enabled, it will only register the budget so long as the server cluster is enabled.maxUnavailable (
integer: null
) - The maximum number of unavailable pods. By default, this will be automatically computed based on theserver.replicas
value to be(n/2)-1
. If you need to set this to0
, you will need to add a--set 'server.disruptionBudget.maxUnavailable=0'
flag to the helm chart installation command because of a limitation in the Helm templating language.
extraConfig (
string: "{}"
) - A raw string of extra JSON configuration for Consul servers. This will be saved as-is into a ConfigMap that is read by the Consul server agents. This can be used to add additional configuration that isn’t directly exposed by the chart.# ExtraConfig values are formatted as a multi-line string:
extraConfig: |
{
"log_level": "DEBUG"
}
This can also be set using Helm’s
--set
flag (consul-helm v0.7.0 and later), using the following syntax:--set 'server.extraConfig="{"log_level": "DEBUG"}"'
extraVolumes (
array: []
) - A list of extra volumes to mount for server agents. This is useful for bringing in extra data that can be referenced by other configurations at a well known path, such as TLS certificates or Gossip encryption keys. The value of this should be a list of objects. Each object supports the following keys:type (
string: required
) - Type of the volume, must be one of “configMap” or “secret”. Case sensitive.name (
string: required
) - Name of the configMap or secret to be mounted. This also controls the path that it is mounted to. The volume will be mounted to/consul/userconfig/<name>
.load (
boolean: false
) - If true, then the agent will be configured to automatically load HCL/JSON configuration files from this volume with-config-dir
. This defaults to false.extraVolumes:
- type: "secret"
name: "consul-certs"
load: false
affinity (
string
) - This value defines the affinity for server pods. It defaults to allowing only a single pod on each node, which minimizes risk of the cluster becoming unusable if a node is lost. If you need to run more pods per node (for example, testing on Minikube), set this value tonull
.# Recommended default server affinity:
affinity: |
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: {{ template "consul.name" . }}
release: "{{ .Release.Name }}"
component: server
topologyKey: kubernetes.io/hostname
tolerations (
string: ""
) - Toleration settings for server pods. This should be a multi-line string matching the Tolerations array in a Pod spec.nodeSelector (
string: null
) - This value defines nodeSelector labels for server pod assignment, formatted as a multi-line string.nodeSelector: |
beta.kubernetes.io/arch: amd64
priorityClassName (
string
) - This value references an existing Kubernetes priorityClassName that can be assigned to server pods.extraLabels (
map
) - Extra labels to attach to the server pods. This should be a YAML map.extraLabels:
labelKey: "label-value"
anotherLabelKey: "another-label-value"
annotations (
string
) - This value defines additional annotations for server pods. This should be a formatted as a multi-line string.annotations: |
"sample/annotation1": "foo"
"sample/annotation2": "bar"
service - Server service properties
annotations Annotations to apply to the server service.
annotations: |
"annotation-key": "annotation-value"
extraEnvironmentVars ((#v-server-extra-environment-vars (
string: "{}"
) - extraEnvironmentVars is a list of extra environment variables to set within the stateful set. These could be used to include proxy settings required for cloud auto-join feature, in case kubernetes cluster is behind egress http proxies. Additionally, it could be used to configure custom consul parameters.
externalServers - Configuration for Consul servers when the servers are running outside of Kubernetes. When running external servers, configuring these values is recommended if setting
global.tls.enableAutoEncrypt
to true (requires consul-k8s >= 0.13.0) orglobal.acls.manageSystemACLs
to true (requires consul-k8s >= 0.14.0).enabled (
boolean: false
) - If true, the Helm chart will be configured to talk to the external servers. If setting this to true, you must also setserver.enabled
to false.hosts (
array<string>: null
) - An array of external Consul server hosts that are used to make HTTPS connections from the components in this Helm chart. Valid values include IPs, DNS names, or Cloud auto-join string. The port must be provided separately below. Note:client.join
must also be set to the hosts that should be used to join the cluster. In most cases, theclient.join
values should be the same, however, they may be different if you wish to use separate hosts for the HTTPS connections.httpsPort (
integer: 8501
) - The HTTPS port of the Consul servers.tlsServerName (
string: null
) - The server name to use as the SNI host header when connecting with HTTPS.useSystemRoots (
boolean: false
) - If true, consul-k8s components will ignore the CA set in global.tls.caCert when making HTTPS calls to Consul servers and will instead use the consul-k8s image’s system CAs for TLS verification. If false, consul-k8s components will useglobal.tls.caCert
when making HTTPS calls to Consul servers. NOTE: This does not affect Consul’s internal RPC communication which will always useglobal.tls.caCert
.k8sAuthMethodHost (
string: null
) - If you are settingglobal.acls.manageSystemACLs
andconnectInject.enabled
to true, setk8sAuthMethodHost
to the address of the Kubernetes API server. This address must be reachable from the Consul servers. Please see the Kubernetes Auth Method documentation. Requires consul-k8s >= 0.14.0.You could retrieve this value from your
kubeconfig
by running:kubectl config view \
-o jsonpath="{.clusters[?(@.name=='<your cluster name>')].cluster.server}"
client - Values that configure running a Consul client on Kubernetes nodes.
enabled (
boolean: global.enabled
) - If true, the chart will install all the resources necessary for a Consul client on every Kubernetes node. This does not requireserver.enabled
, since the agents can be configured to join an external cluster.image (
string: global.image
) - The name of the Docker image (including any tag) for the containers running Consul client agents.join (
array<string>: null
) - A list of valid -retry-join values. If this isnull
(default), then the clients will attempt to automatically join the server cluster running within Kubernetes. This means that withserver.enabled
set to true, clients will automatically join that cluster. Ifserver.enabled
is not true, then a value must be specified so the clients can join a valid cluster.dataDirectoryHostPath (
string: null
) - An absolute path to a directory on the host machine to use as the Consul client data directory. If set to the empty string or null, the Consul agent will store its data in the Pod’s local filesystem (which will be lost if the Pod is deleted). Security Warning: If setting this, Pod Security Policies must be enabled on your cluster and in this Helm chart (via the global.enablePodSecurityPolicies setting) to prevent other Pods from mounting the same host path and gaining access to all of Consul’s data. Consul’s data is not encrypted at rest.grpc (
boolean: true
) - If true, agents will enable their GRPC listener on port 8502 and expose it to the host. This will use slightly more resources, but is required for Connect.exposeGossipPorts (
boolean: false
) - If true, the Helm chart will expose the clients’ gossip ports as hostPorts. This is only necessary if pod IPs in the k8s cluster are not directly routable and the Consul servers are outside of the k8s cluster. This also changes the clients’ advertised IP to thehostIP
rather thanpodIP
.resources (
string: null
) - The resource requests (CPU, memory, etc.) for each of the client agents. This should be a multi-line string mapping directly to a Kubernetes ResourceRequirements object. If this isn’t specified, then the pods won’t request any specific amount of resources.# Resources are defined as a formatted multi-line string:
resources: |
requests:
memory: "10Gi"
limits:
memory: "10Gi"
extraConfig (
string: "{}"
) - A raw string of extra JSON configuration for Consul clients. This will be saved as-is into a ConfigMap that is read by the Consul agents. This can be used to add additional configuration that isn’t directly exposed by the chart.# ExtraConfig values are formatted as a multi-line string:
extraConfig: |
{
"log_level": "DEBUG"
}
This can also be set using Helm’s
--set
flag (consul-helm v0.7.0 and later), using the following syntax:--set 'client.extraConfig="{"log_level": "DEBUG"}"'
extraVolumes (
array: []
) - A list of extra volumes to mount for client agents. This is useful for bringing in extra data that can be referenced by other configurations at a well known path, such as TLS certificates or Gossip encryption keys. The value of this should be a list of objects. Each object supports the following keys:type (
string: required
) - Type of the volume, must be one of “configMap” or “secret”. Case sensitive.name (
string: required
) - Name of the configMap or secret to be mounted. This also controls the path that it is mounted to. The volume will be mounted to/consul/userconfig/<name>
.load (
boolean: false
) - If true, then the agent will be configured to automatically load HCL/JSON configuration files from this volume with-config-dir
. This defaults to false.extraVolumes:
- type: 'secret'
name: 'consul-certs'
load: false
tolerations (
string: ""
) - Toleration Settings for client pods. This should be a multi-line string matching the Toleration array in a Pod spec. The example below will allow client pods to run on every node regardless of taints.tolerations: |
- operator: "Exists"
nodeSelector (
string: null
) - Labels for client pod assignment, formatted as a multi-line string. Please see Kubernetes docs for more details.nodeSelector: |
beta.kubernetes.io/arch: amd64
affinity (
string
) - This value defines the affinity for client pods, formatted as a multi-line YAML string.priorityClassName (
string: ""
) - This value references an existing Kubernetes priorityClassName that can be assigned to client pods.annotations (
string: null
) - This value defines additional annotations for client pods. This should be a formatted as a multi-line string.annotations: |
"sample/annotation1": "foo"
"sample/annotation2": "bar"
extraEnvironmentVars ((#v-client-extra-environment-vars (
string: "{}"
) - extraEnvironmentVars is a list of extra environment variables to set with the pod. These could be used to include proxy settings required for cloud auto-join feature, in case kubernetes cluster is behind egress http proxies. Additionally, it could be used to configure custom consul parameters.dnsPolicy (
string: null
) - This value defines the Pod DNS policy for client pods to use.hostNetwork (
boolean: false
) - Defines whether or not we use host networking instead of hostPort in the event that a CNI plugin doesnt support hostPort. This has security implications and is not recommended as doing so gives the consul client unnecessary access to all network traffic on the host. In most cases, pod network and host network are on different networks so this should be combined withdnsPolicy: ClusterFirstWithHostNet
.updateStrategy (
string: null
) - The update strategy for the clientDaemonSet
.updateStrategy: |
rollingUpdate:
maxUnavailable: 5
type: RollingUpdate
-
Enterprise
- Values for setting up and running snapshot agents within the Consul clusters. They are required to be co-located with Consul clients, so will inherit the clients’ nodeSelector, tolerations and affinity.
enabled (
boolean: false
) - If true, the chart will install resources necessary to run the snapshot agent.replicas (
integer: 2
) - The number of snapshot agents to run.configSecret - A Kubernetes secret that should be manually created to contain the entire config to be used on the snapshot agent. This is the preferred method of configuration since there are usually storage credentials present. Please see Snapshot agent config for details.
secretName ((#v-client-snapshotagent-configsecret-secretname))
(string: null)
- The name of the Kubernetes secret.secretKey ((#v-client-snapshotagent-configsecret-secretkey))
(string: null)
- The key of the Kubernetes secret.
caCert (
string: null
) - Optional PEM-encoded CA certificate that will be added to the trusted system CAs. Useful if using an S3-compatible storage exposing a self-signed certificate.caCert: |
-----BEGIN CERTIFICATE-----
MIIC7jCCApSgAwIBAgIRAIq2zQEVexqxvtxP6J0bXAwwCgYIKoZIzj0EAwIwgbkx
...
resources (
map
) - Resource settings for snapshot agent pods. See the values file for defaults.
dns - Values that configure Consul DNS service.
enabled (
boolean: global.enabled
) - If true, aconsul-dns
service will be created that exposes port 53 for TCP and UDP to the running Consul agents (servers and clients). This can then be used to configure kube-dns. The Helm chart does not automatically configure kube-dns.type (
string: ClusterIP
) - Type can be used to control the type of service created. For example, setting this to “LoadBalancer” will create an external load balancer (for supported K8S installations).clusterIP (
string: null
) - If defined, this value configures the cluster IP of the DNS service.annotations (
string: null
) - Extra annotations to attach to the DNS service. This should be a multi-line string of annotations to apply to the DNS service.additionalSpec (
string: null
) - Additional ServiceSpec values. This should be a multi-line string mapping directly to a Kubernetes ServiceSpec object.
syncCatalog - Values that configure the service sync process.
enabled (
boolean: false
) - If true, the chart will install all the resources necessary for the catalog sync process to run.image (
string: global.imageK8S
) - The name of the Docker image (including any tag) for consul-k8s to run the sync program.default (
boolean: true
) - If true, all valid services in K8S are synced by default. If false, the service must be annotated properly to sync. In either case an annotation can override the default.toConsul (
boolean: true
) - If true, will sync Kubernetes services to Consul. This can be disabled to have a one-way sync.toK8S (
boolean: true
) - If true, will sync Consul services to Kubernetes. This can be disabled to have a one-way sync.k8sPrefix (
string: ""
) - A prefix to prepend to all services registered in Kubernetes from Consul. This defaults to""
where no prefix is prepended; Consul services are synced with the same name to Kubernetes. (Consul -> Kubernetes sync only)k8sAllowNamespaces (
[]string: ["*"]
) - list of k8s namespaces to sync the k8s services from. If a k8s namespace is not included in this list or is listed ink8sDenyNamespaces
, services in that k8s namespace will not be synced even if they are explicitly annotated. Use["*"]
to automatically allow all k8s namespaces. For example,["namespace1", "namespace2"]
will only allow services in the k8s namespacesnamespace1
andnamespace2
to be synced and registered with Consul. All other k8s namespaces will be ignored. Note:k8sDenyNamespaces
takes precedence over values defined here. Requires consul-k8s v0.12+k8sDenyNamespaces (
[]string: ["kube-system", "kube-public"]
- list of k8s namespaces that should not have their services synced. This list takes precedence overk8sAllowNamespaces
.*
is not supported because then nothing would be allowed to sync. Requires consul-k8s v0.12+.For example, if
k8sAllowNamespaces
is["*"]
andk8sDenyNamespaces
is["namespace1", "namespace2"]
, then all k8s namespaces besidesnamespace1
andnamespace2
will be synced.k8sSourceNamespace (
string: ""
) - [DEPRECATED] Usek8sAllowNamespaces
andk8sDenyNamespaces
instead.k8sSourceNamespace
is the Kubernetes namespace to watch for service changes and sync to Consul. If this is not set then it will default to all namespaces.-
Enterprise
- These settings manage the catalog sync’s interaction with Consul namespaces (requires consul-ent v1.7+ and consul-k8s v0.12+). Also,
global.enableConsulNamespaces
must be true.consulDestinationNamespace (
string: "default"
) - Name of the Consul namespace to register all k8s services into. If the Consul namespace does not already exist, it will be created. This will be ignored ifmirroringK8S
is true.mirroringK8S (
boolean: false
) - causes k8s services to be registered into a Consul namespace of the same name as their k8s namespace, optionally prefixed ifmirroringK8SPrefix
is set below. If the Consul namespace does not already exist, it will be created. Turning this on overrides theconsulDestinationNamespace
setting.addK8SNamespaceSuffix
may no longer be needed if enabling this option.mirroringK8SPrefix (
string: ""
) - IfmirroringK8S
is set to true,mirroringK8SPrefix
allows each Consul namespace to be given a prefix. For example, ifmirroringK8SPrefix
is set to"k8s-"
, a service in the k8sstaging
namespace will be registered into thek8s-staging
Consul namespace.
addK8SNamespaceSuffix (
boolean: true
) - If true, sync catalog will append Kubernetes namespace suffix to each service name synced to Consul, separated by a dash. For example, for a servicefoo
in thedefault
namespace, the sync process will create a Consul service namedfoo-default
. Set this flag to true to avoid registering services with the same name but in different namespaces as instances for the same Consul service. Namespace suffix is not added ifannotationServiceName
is provided.consulPrefix (
string: ""
) - A prefix to prepend to all services registered in Consul from Kubernetes. This defaults to""
where no prefix is prepended. Service names within Kubernetes remain unchanged. (Kubernetes -> Consul sync only) The prefix is ignored ifannotationServiceName
is provided.k8sTag (
string: null
) - An optional tag that is applied to all of the Kubernetes services that are synced into Consul. If nothing is set, this defaults to “k8s”. (Kubernetes -> Consul sync only)syncClusterIPServices (
boolean: true
) - If true, will sync Kubernetes ClusterIP services to Consul. This can be disabled to have the sync ignore ClusterIP-type services.nodePortSyncType (
string: ExternalFirst
) - Configures the type of syncing that happens for NodePort services. The only valid options are:ExternalOnly
,InternalOnly
, andExternalFirst
.ExternalOnly
will only use a node’s ExternalIP address for the sync, otherwise the service will not be synced.InternalOnly
uses the node’s InternalIP address.ExternalFirst
will preferentially use the node’s ExternalIP address, but if it doesn’t exist, it will use the node’s InternalIP address instead.aclSyncToken - references a Kubernetes secret that contains an existing Consul ACL token. This will provide the sync process the correct permissions. This is only needed if ACLs are enabled on the Consul cluster.
secretName
(string: null)
- The name of the Kubernetes secret. This defaults to null.secretKey
(string: null)
- The key for the Kubernetes secret. This defaults to null.
nodeSelector (
string: null
) - This value defines nodeSelector labels forsyncCatalog
pod assignment, formatted as a multi-line string.nodeSelector: |
beta.kubernetes.io/arch: amd64
affinity (
string: null
) - Affinity setting for sync catalog pods. This should be a multi-line string matching the affinity object.priorityClassName (
string: ""
) - Priority class name setting for sync catalog pods.tolerations (
string: null
) - Tolerations setting for sync catalog pods. This should be a multi-line string matching the Toleration array in a PodSpec.consulNodeName (
string: "k8s-sync"
) - Defines the Consul synthetic node that all services will be registered to. NOTE: Changing the node name and upgrading the Helm chart will leave all of the previously sync’d services registered with Consul and register them again under the new Consul node name. The out-of-date registrations will need to be explicitly removed.resources (
map
) - Resource settings for sync catalog pods. See values file for defaults.logLevel (
string: info
) - Log verbosity level. One of “trace”, “debug”, “info”, “warn”, or “error”.consulWriteInterval (
string: null
) - Override the default interval to perform syncing operations creating Consul services.
ui - Values that configure the Consul UI.
enabled (
boolean: global.enabled
) - If true, the UI will be enabled. This will only enable the UI, it doesn’t automatically register any service for external access. The UI will only be enabled on server agents. Ifserver.enabled
is false, then this setting has no effect. To expose the UI in some way, you must configureui.service
.service - This configures the
Service
resource registered for the Consul UI.enabled (
boolean: true
) - This will enable/disable registering a Kubernetes Service for the Consul UI. This value only takes effect ifui.enabled
is true and taking effect.type (
string: null
) - The service type to register. This defaults tonull
which doesn’t set an explicit service type, which typically is defaulted to “ClusterIP” by Kubernetes. The available service types are documented on the Kubernetes website.annotations (
string: null
) - Annotations to apply to the UI service.annotations: |
"annotation-key": "annotation-value"
additionalSpec (
string: null
) - Additional Service spec values. This should be a multi-line string mapping directly to a KubernetesService
object.
connectInject - Values that configure running the Connect injector.
enabled (
boolean: false
) - If true, the chart will install all the resources necessary for the Connect injector process to run. This will enable the injector but will require pods to opt-in with an annotation by default.image (
string: global.imageK8S
) - The name of the Docker image (including any tag) for the consul-k8s binary.default (
boolean: false
) - If true, the injector will inject the Connect sidecar into all pods by default. Otherwise, pods must specify the. injection annotation to opt-in to Connect injection. If this is true, pods can use the same annotation to explicitly opt-out of injection.imageConsul (
string: global.image
) - The name of the Docker image (including any tag) for Consul. This is used for proxy service registration, Envoy configuration, etc.namespaceSelector (
string: ""
) - A [selector](https:// kubernetes.io/docs/concepts/overview/working-with-objects/labels/) for restricting injection to only matching namespaces. By default all namespaces exceptkube-system
andkube-public
will have injection enabled.namespaceSelector: |
matchLabels:
namespace-label: label-value
k8sAllowNamespaces - list of k8s namespaces to allow Connect sidecar injection in. If a k8s namespace is not included or is listed in
k8sDenyNamespaces
, pods in that k8s namespace will not be injected even if they are explicitly annotated. Use["*"]
to automatically allow all k8s namespaces.For example,
["namespace1", "namespace2"]
will only allow pods in the k8s namespacesnamespace1
andnamespace2
to have Connect sidecars injected and registered with Consul. All other k8s namespaces will be ignored.Note:
k8sDenyNamespaces
takes precedence over values defined here andnamespaceSelector
takes precedence over both since it is applied first.kube-system
andkube-public
are never injected, even if included here. Requires consul-k8s v0.12+k8sDenyNamespaces - list of k8s namespaces that should not allow Connect sidecar injection. This list takes precedence over
k8sAllowNamespaces
.*
is not supported because then nothing would be allowed to be injected.For example, if
k8sAllowNamespaces
is["*"]
andk8sDenyNamespaces
is["namespace1", "namespace2"]
, then all k8s namespaces besidesnamespace1
andnamespace2
will be injected.Note:
namespaceSelector
takes precedence over this since it is applied first.kube-system
andkube-public
are never injected. Requires consul-k8s v0.12+.-
Enterprise
- These settings manage the connect injector’s interaction with Consul namespaces (requires consul-ent v1.7+ and consul-k8s v0.12+). Also,
global.enableConsulNamespaces
must be true.consulDestinationNamespace (
string: "default"
) - Name of the Consul namespace to register all k8s services into. If the Consul namespace does not already exist, it will be created. This will be ignored ifmirroringK8S
is true.mirroringK8S (
boolean: false
) - causes k8s services to be registered into a Consul namespace of the same name as their k8s namespace, optionally prefixed ifmirroringK8SPrefix
is set below. If the Consul namespace does not already exist, it will be created. Turning this on overrides theconsulDestinationNamespace
setting.mirroringK8SPrefix (
string: ""
) - IfmirroringK8S
is set to true,mirroringK8SPrefix
allows each Consul namespace to be given a prefix. For example, ifmirroringK8SPrefix
is set to"k8s-"
, a service in the k8sstaging
namespace will be registered into thek8s-staging
Consul namespace.
certs - The certs section configures how the webhook TLS certs are configured. These are the TLS certs for the Kube apiserver communicating to the webhook. By default, the injector will generate and manage its own certs, but this requires the ability for the injector to update its own
MutatingWebhookConfiguration
. In a production environment, custom certs should probably be used. Configure the values below to enable this.secretName (
string: null
) - secretName is the name of the Kubernetes secret that has the TLS certificate and private key to serve the injector webhook. If this is null, then the injector will default to its automatic management mode.caBundle (
string: ""
) - The PEM-encoded CA public certificate bundle for the TLS certificate served by the injector. This must be specified as a string and can’t come from a secret because it must be statically configured on the KubernetesMutatingAdmissionWebhook
resource. This only needs to be specified ifsecretName
is not null.certName (
string: "tls.crt"
) - The name of the certificate file within thesecretName
secret.keyName (
string: "tls.key"
) - The name of the private key for the certificate file within thesecretName
secret.
nodeSelector (
string: null
) - This value defines nodeSelector labels forconnectInject
pod assignment, formatted as a multi-line string.nodeSelector: |
beta.kubernetes.io/arch: amd64
affinity (
string: null
) - Affinity setting for Connect injector pods. This should be a multi-line string matching the affinity object.tolerations (
string: null
) - Tolerations setting for Connect injector pods. This should be a multi-line string matching the Toleration array in a PodSpec.priorityClassName (
string: ""
) - Priority class name setting for Connect injector pods.aclBindingRuleSelector (
string: "serviceaccount.name!=default"
) - A selector for restricting automatic injection to only matching services based on their associated service account. By default, services using thedefault
Kubernetes service account will be prevented from logging in. This only has effect if ACLs are enabled. Requires Consul 1.5+ and consul-k8s 0.8.0+.overrideAuthMethodName (
string: ""
) - If not usingglobal.acls.manageSystemACLs
and instead manually setting up an auth method for Connect inject, set this to the name of your Auth method.aclInjectToken - Refers to a Kubernetes secret that you have created that contains an ACL token for your Consul cluster which allows the Connect injector the correct permissions. This is only needed if Consul namespaces and ACLs are enabled on the Consul cluster and you are not setting
global.acls.manageSystemACLs
totrue
. This token needs to haveoperator = "write"
privileges so that it can create namespaces.secretName
(string: null)
- The name of the Kubernetes secret.secretKey
(string: null)
- The key within the Kubernetes secret that holds the acl token.
centralConfig - Values that configure Consul’s central configuration feature (requires Consul v1.5+ and consul-k8s v0.8.1+).
enabled (
boolean: true
) - Turns on the central configuration feature. Pods that have a Connect proxy injected will have their service automatically registered in this central configuration.defaultProtocol (
string: null
) - If defined, this value will be used as the default protocol type for all services registered with the central configuration. This can be overridden by using the protocol annotation directly on any pod spec.proxyDefaults (
string: "{}"
) - This value is a raw json string that will be applied to all Connect proxy sidecar pods. It can include any valid configuration for the configured proxy.# proxyDefaults values are formatted as a multi-line string:
proxyDefaults: |
{
"envoy_dogstatsd_url": "udp://127.0.0.1:9125"
}
resources (
map
) - Resource settings for connect inject pods. See values file for defaults.initContainer - As part of the Connect injection process, a utility init container is created that runs various startup tasks including registering the service with Consul.
resources (
map
) - The resource requests and limits (CPU, memory, etc.) for all of the Connect-injected init containers. This should be a YAML map of a Kubernetes ResourceRequirements object. See values file for defaults.# Resources are defined as a YAML map:
resources:
requests:
memory: '25Mi'
cpu: '20m'
limits:
memory: '50Mi'
cpu: '20m'
sidecarProxy - Configure the sidecar proxy that is injected into each Connect pod.
resources - The default resource requests and limits (CPU, memory) for the Envoy sidecar proxy that is injected into each Connect pod. This should be a YAML map of a Kubernetes ResourceRequirements object. By default, each key is set to
null
, which results in no resource limits.These defaults can be overridden on a per-pod basis via annotation.
# Recommended defaults
resources:
requests:
memory: '100Mi'
cpu: '100m'
limits:
memory: '100Mi'
cpu: '100m'
meshGateway - Configure mesh gateways.
enabled (
boolean: true
) - If mesh gateways are enabled, a Deployment will be created that runs gateways and Consul Connect will be configured to use gateways. See mesh gateway docs. Requirements: Consul 1.6.0+ and consul-k8s 0.15.0+ if usingglobal.acls.manageSystemACLs
.globalMode (
string: "local"
) - Globally configure which mode the gateway should run in. Can be set to either"remote"
,"local"
,"none"
or""
ornull
. See mesh gateway modes of operation for a description of each mode. If set to anything other than""
ornull
,connectInject.centralConfig.enabled
should be set to true so that the global config will actually be used. If set to the empty string, no global default will be set and the gateway mode will need to be set individually for each service.replicas (
integer: 2
) - Number of replicas for the Deployment.wanAddress - What gets registered as WAN (wide area network) address for the gateway.
source (
string: "Service"
) - source configures where to retrieve the WAN address (and possibly port) for the mesh gateway from. Can be set to either:Service
,NodeIP
,NodeName
orStatic
. See the behavior of each below:Service - Determine the address based on the service type.
If
service.type=LoadBalancer
use the external IP or hostname of the service. Use the port set byservice.port
.If
service.type=NodePort
use the Node IP. The port will be set toservice.nodePort
soservice.nodePort
cannot be null.If
service.type=ClusterIP
use the ClusterIP. The port will be set toservice.port
.service.type=ExternalName
is not supported.NodeIP - The node IP as provided by the Kubernetes downward API.
NodeName - The name of the node as provided by the Kubernetes downward API. This is useful if the node names are DNS entries that are routable from other datacenters.
Static - Use the address hardcoded in
meshGateway.wanAddress.static
.
port (
integer: 443
) - Port that gets registered for WAN traffic. If source is set to “Service” then this setting will have no effect. See the documentation forsource
as to which port will be used in that case.static (
string: ""
) - If source is set to “Static” then this value will be used as the WAN address of the mesh gateways. This is useful if you’ve configured a DNS entry to point to your mesh gateways.
service - The service option configures the Service that fronts the Gateway Deployment.
enabled (
boolean: true
) - Whether to create a Service or not.type (
string: "LoadBalancer"
) - Type of service, ex. LoadBalancer, ClusterIP.port (
integer: 443
) - Port that the service will be exposed on. ThetargetPort
will be set tomeshGateway.containerPort
.nodePort (
integer: null
) - Optionally hardcode thenodePort
of the service if using a NodePort service. If not set and using a NodePort service, Kubernetes will automatically assign a port.annotations (
string: null
) - Annotations to apply to the mesh gateway service.annotations: |
"sample/annotation1": "foo"
"sample/annotation2": "bar"
additionalspec (
string: null
) - Optional YAML string that will be appended to the Service spec.
hostNetwork (
boolean: false
) - If set to true, gateway Pods will run on the host network.dnsPolicy (
string: null
) -dnsPolicy
to use.consulServiceName (
string: "mesh-gateway"
) - Consul service name for the mesh gateways. Cannot be set to anything other than"mesh-gateway"
ifglobal.acls.manageSystemACLs
is true since the ACL token generated is only for the name “mesh-gateway”.containerPort (
integer: 8443
) - Port that the gateway will run on inside the container.hostPort (
integer: null
) - OptionalhostPort
for the gateway to be exposed on. This can be used withwanAddress.port
andwanAddress.useNodeIP
to expose the gateways directly from the node. IfhostNetwork=true
, this must benull
or set to the same port ascontainerPort
. NOTE: Cannot set to 8500 or 8502 because those are reserved for the Consul agent.resources (
string
) - Resources for gateway pods. See values file for default.initCopyConsulContainer - A utility init container used to copy the Consul binary into a shared location.
resources (
map
) - The resource requests and limits (CPU, memory, etc.) for thecopy-consul-bin
init container. This should be a YAML map of a Kubernetes ResourceRequirements object. See values file for defaults.# Resources are defined as a YAML map:
resources:
requests:
memory: '25Mi'
cpu: '50m'
limits:
memory: '150Mi'
cpu: '50m'
affinity (
string
) - Affinity setting for gateway pods. See values file for default.tolerations (
string: null
) - Optional YAML string to specify tolerations.nodeSelector (
string: null
) - Optional YAML string to specify nodeSelector config.priorityClassName (
string: ""
) - Optional priorityClassName.annotations (
string: null
) - Annotations for the mesh gateway deployment.
ingressGateways - Configuration options for ingress gateways. Default values for all ingress gateways are defined in
ingressGateways.defaults
. Any of these values may be overridden iningressGateways.gateways
for a specific gateway with the exception of annotations. Annotations will include both the default annotations and any additional ones defined for a specific gateway. Requirements: consul >= 1.8.0. If usingglobal.acls.manageSystemACLs
, consul-k8s >= 0.16.0 is needed.enabled (
boolean: false
) - Enable ingress gateway deployment. RequiresconnectInject.enabled=true
.defaults - Defaults sets default values for all gateway fields. With the exception of annotations, defining any of these values in the
gateways
list will override the default values provided here.replicas (
integer: 2
) - Number of replicas for each ingress gateway defined.service - The service options configure the service that fronts the gateway deployment.
type (
string: "ClusterIP"
) - Type of service: LoadBalancer, ClusterIP or NodePort. If using NodePort service type, you must set the desired nodePorts in theports
setting below.ports - Ports that will be exposed on the service and gateway container. Any ports defined as ingress listeners on the gateway’s Consul configuration entry should be included here. The first port will be used as part of the Consul service registration for the gateway and be listed in its SRV record. If using a NodePort service type, you must specify the desired nodePort for each exposed port.
port (
integer: 8080
) - Port to open in both ingress gateway container and the service fronting the deployment. These should correspond to the listeners defined in the gateways’ Consul configuration entry. The first defined port to be used in the Consul service registration for the ingress gateway and be listed in its SRV record. Note: GKE does not allow exposing port 80.nodePort (
integer: null
) - The nodePort to open if using a NodePort type service. The first defined nodePort will be used with the Kubernetes node’s host ip in the Consul service registration.
annotations (
string: null
) - Annotations to apply to the ingress gateway service.annotations: |
"annotation-key": "annotation-value"
additionalSpec (
string: null
) - Optional YAML string that will be appended to the Service spec.
resources (
string
) - Resources for gateway pods. See values file for default.initCopyConsulContainer - A utility init container used to copy the Consul binary into a shared location.
resources (
map
) - The resource requests and limits (CPU, memory, etc.) for thecopy-consul-bin
init container. This should be a YAML map of a Kubernetes ResourceRequirements object. See values file for defaults.# Resources are defined as a YAML map:
resources:
requests:
memory: '25Mi'
cpu: '50m'
limits:
memory: '150Mi'
cpu: '50m'
affinity (
string
) - Affinity setting for gateway pods. See values file for default.tolerations (
string: null
) - Optional YAML string to specify tolerations.nodeSelector (
string: null
) - Optional YAML string to specify nodeSelector config.priorityClassName (
string: ""
) - Optional priorityClassName.annotations (
string: null
) - Annotations for the ingress gateway deployment. Annotations defined here will be applied to all ingress gateway deployments in addition to any annotations defined for a specific gateway iningressGateways.gateways
.annotations: |
"annotation-key": "annotation-value"
consulNamespace (
string: "default"
)Enterprise
- Defines the Consul namespace to register the gateway into. Requires
global.enableConsulNamespaces
to be true and Consul Enterprise v1.7+ with a valid Consul Enterprise license. Note: The Consul namespace MUST exist before the gateway is deployed.
gateways - Gateways is a list of gateway objects. The only required field for each is
name
, though they can also contain any of the fields iningressGateways.defaults
. Values defined here override the defaults except in the case of annotations where both will be applied.- name (
string: "ingress-gateway"
) - The name of the ingress gateway.
- name (
terminatingGateways - Configuration options for terminating gateways. Default values for all terminating gateways are defined in
terminatingGateways.defaults
. Any of these values may be overridden interminatingGateways.gateways
for a specific gateway with the exception of annotations. Annotations will include both the default annotations and any additional ones defined for a specific gateway. Requirements: consul >= 1.8.0. If usingglobal.acls.manageSystemACLs
, consul-k8s >= 0.16.0 is needed.enabled (
boolean: false
) - Enable terminating gateway deployment. RequiresconnectInject.enabled=true
.defaults - Defaults sets default values for all gateway fields. With the exception of annotations, defining any of these values in the
terminatingGateways.gateways
list will override the default values provided here.replicas (
integer: 2
) - Number of replicas for each terminating gateway defined.extraVolumes (
array: []
) - A list of extra volumes to mount. These will be exposed to Consul in the path/consul/userconfig/<name>/
.extraVolumes:
- type: 'secret'
name: 'my-secret'
items: # optional items array
- key: key
path: path # secret will now mount to /consul/userconfig/my-secret/path
resources (
string
) - Resources for gateway pods. See values file for default.initCopyConsulContainer - A utility init container used to copy the Consul binary into a shared location.
resources (
map
) - The resource requests and limits (CPU, memory, etc.) for thecopy-consul-bin
init container. This should be a YAML map of a Kubernetes ResourceRequirements object. See values file for defaults.# Resources are defined as a YAML map:
resources:
requests:
memory: '25Mi'
cpu: '50m'
limits:
memory: '150Mi'
cpu: '50m'
affinity (
string
) - Affinity setting for gateway pods. See values file for default.tolerations (
string: null
) - Optional YAML string to specify tolerations.nodeSelector (
string: null
) - Optional YAML string to specify nodeSelector config.priorityClassName (
string: ""
) - Optional priorityClassName.annotations (
string: null
) - Annotations for the terminating gateway deployment. Annotations defined here will be applied to all terminating gateway deployments in addition to any annotations defined for a specific gateway interminatingGateways.gateways
.annotations: |
"annotation-key": "annotation-value"
consulNamespace (
string: "default"
)Enterprise
- Defines the Consul namespace to register the gateway into. Requires
global.enableConsulNamespaces
to be true and Consul Enterprise v1.7+ with a valid Consul Enterprise license. Note: The Consul namespace MUST exist before the gateway is deployed.
gateways - Gateways is a list of gateway objects. The only required field for each is
name
, though they can also contain any of the fields interminatingGateways.defaults
. Values defined here override the defaults except in the case of annotations where both will be applied.- name (
string: "terminating-gateway"
) - The name of the terminating gateway.
- name (
tests - Control whether to enable a test for this Helm chart.
- enabled (
boolean: true
) - If true, the test Pod manifest will be generated to be used as a Helm test. The pod will be created when ahelm test
command is executed.
- enabled (
Helm Chart Examples
The below config.yaml
results in a single server Consul cluster with a LoadBalancer
to allow external access to the UI and API.
# config.yaml
server:
replicas: 1
bootstrapExpect: 1
ui:
service:
type: LoadBalancer
The below config.yaml
results in a three server Consul Enterprise cluster with 100GB of storage and automatic Connect injection.
Note, this would require a secret that contains the enterprise license key.
# config.yaml
global:
image: 'hashicorp/consul-enterprise:1.4.2-ent'
server:
replicas: 3
bootstrapExpect: 3
enterpriseLicense:
secretName: 'consul-license'
secretKey: 'key'
storage: 100Gi
connect: true
client:
grpc: true
connectInject:
enabled: true
default: false
Customizing the Helm Chart
Consul within Kubernetes is highly configurable and the Helm chart contains dozens of the most commonly used configuration options. If you need to extend the Helm chart with additional options, we recommend using a third-party tool, such as kustomize or ship. Note that the Helm chart heavily relies on Helm lifecycle hooks, and so features like bootstrapping ACLs or TLS will not work as expected. Additionally, we can make changes to the internal implementation (e.g., renaming template files) that may be backward incompatible with such customizations.