본문으로 건너뛰기

01. Install

약 3 분ConsulServiceMeshK8sKubernetes

01. Install

실습을 위한 조건은 다음과 같습니다.

참고 : https://learn.hashicorp.com/collections/consul/kubernetes-productionopen in new window

Consul Gossip

다운받은 Consul 바이너리를 통해 Gossip 암호화 키를 생성합니다

kubectl create secret generic consul-gossip-encryption-key --from-literal=key=$(consul keygen)

License (Option)

발급받은 라이선스 파일을 저장(e.g. consul.hclic)하고 Kubernetes의 secret으로 적용합니다.

kubectl create secret generic license --from-file='key=./consul.hclic'

Helm

Helm repo add & update

helm repo add hashicorp https://helm.releases.hashicorp.com && \
helm repo update

Helm Chart

github : https://github.com/hashicorp/consul-helm/blob/master/values.yamlopen in new window

Helm 설치를 위한 파일(e.g. value.yaml) 을 작성합니다.

global:
  enabled: true
  name: consul
  image: hashicorp/consul-enterprise:1.11.3-ent
  enableConsulNamespaces: true
  adminPartitions:
    enabled: false
  datacenter: dc1
  # enterpriseLicense:
  #   secretName: license
  #   secretKey: key
  gossipEncryption:
    secretName: consul-gossip-encryption-key
    secretKey: key
  tls:
    enabled: false
    enableAutoEncrypt: true
  enableConsulNamespaces: true

client:
  enabled: true
  grpc: true

connectInject:
  enabled: true
  replicas: 2

dns:
  enabled: true

controller:
  enabled: true

syncCatalog:
  enabled: true
  toConsul: false
  consulNamespaces:
    mirroringK8S: true

설치

kubectl config use-context $(grep gs-cluster-0 KCONFIG.txt)
helm install consul -f ./values.yaml hashicorp/consul --version v0.40.0 --debug

UI 확인

kubectl port-forward service/consul-server 8500:8500

http://localhost:8500/uiopen in new window