Skip to content

Instantly share code, notes, and snippets.

@taking
Created January 9, 2023 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taking/c743f36c3f1c498af34b46d01491b648 to your computer and use it in GitHub Desktop.
Save taking/c743f36c3f1c498af34b46d01491b648 to your computer and use it in GitHub Desktop.

consul (server) Installation with Helm

  • consul (server) on Kubernetes

Prerequisites

  • Kubernetes 1.20+
  • Helm 3.2.0+

Helm Chart Reference

helm update

helm repo add hashicorp https://helm.releases.hashicorp.com
helm repo update hashicorp
cat <<EOF > consul-values.yaml
# Configure global settings in this section.
global:
  name: consul
  # Bootstrap ACLs within Consul. This is highly recommended.
  acls:
    manageSystemACLs: true
  # Gossip encryption
  gossipEncryption:
    autoGenerate: true
# Enable and configure the Consul UI.
ui:
  enabled: true
# Enable Consul connect pod injection
connectInject:
  enabled: true
  default: true
controller:
  enabled: true
EOF

install

helm upgrade my-consul hashicorp/consul \
  --install \
  --create-namespace \
  --namespace consul \
  -f consul-values.yaml
kubectl exec --stdin --tty consul-server-0 --namespace consul -- /bin/sh
consul members

image

(Option) Traefik IngressRoute

cat <<'EOF' | kubectl apply -f -
# dashboard.yaml
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: consul-dashboard
  namespace: consul
spec:
  entryPoints:
  - web
  - websecure
  routes:
  - match: Host(`dashboard.consul.dev-t.xyz`)
    kind: Rule
    services:
    - name: consul-ui
      port: 80
  tls:
    certResolver: cloudflare
EOF

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment