2019-12-18 18:02:26 -08:00
---
2020-04-07 14:55:19 -04:00
layout: docs
2022-09-14 17:44:13 -05:00
page_title: Install Consul on Self-Hosted Kubernetes Clusters
description: >-
2022-09-16 10:28:32 -05:00
The process for installing Consul on Kubernetes is the same as installing it on cloud-hosted k8s platforms, but requires additional configuration. Learn how to pre-define Persistent Volume Claims (PVCs) and a default storage class for server agents.
2019-12-18 18:02:26 -08:00
---
2022-09-14 17:44:13 -05:00
# Install Consul on Self-Hosted Kubernetes Clusters
2020-05-11 14:15:59 -07:00
2021-11-05 11:27:49 -07:00
Except for creating persistent volumes and ensuring there is a storage class
configured (see below), installing Consul on your
2020-05-11 14:15:59 -07:00
self-hosted Kubernetes cluster is the same process as installing Consul on a
2023-01-25 10:52:43 -06:00
cloud-hosted Kubernetes cluster. See the [Installation Overview](/consul/docs/k8s/installation/install)
2020-05-11 14:15:59 -07:00
for install instructions.
## Predefined Persistent Volume Claims (PVCs)
2021-06-29 17:17:07 +01:00
If running a self-hosted Kubernetes installation, you may need to pre-create
2020-05-11 14:15:59 -07:00
the persistent volumes for the stateful set that the Consul servers run in.
2019-12-18 18:02:26 -08:00
The only way to use a pre-created PVC is to name them in the format Kubernetes expects:
2020-04-08 20:09:01 -04:00
```text
2019-12-18 18:02:26 -08:00
data-<kubernetes namespace>-<helm release name>-consul-server-<ordinal>
```
The Kubernetes namespace you are installing into, Helm release name, and ordinal
must match between your Consul servers and your pre-created PVCs. You only
need as many PVCs as you have Consul servers. For example, given a Kubernetes
namespace of "vault," a release name of "consul," and 5 servers, you would need
to create PVCs with the following names:
2020-04-08 20:09:01 -04:00
```text
2019-12-18 18:02:26 -08:00
data-vault-consul-consul-server-0
data-vault-consul-consul-server-1
data-vault-consul-consul-server-2
data-vault-consul-consul-server-3
data-vault-consul-consul-server-4
```
2021-11-05 11:27:49 -07:00
## Storage Class
Your Kubernetes installation must either have a default storage class specified
(see https://kubernetes.io/docs/concepts/storage/storage-classes/ and https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/)
or you must specify the storage class for the Consul servers:
```yaml
server:
storageClass: your-class
```
2023-01-25 10:52:43 -06:00
See the [Helm reference](/consul/docs/k8s/helm#v-server-storageclass) for that setting for more information.