helm 启动 consul

发布时间 2023-12-22 15:45:59作者: qgbo

helm 可以启动很简单的consul cluster:

helm install consul  consul/xxx/x  -f consul.yaml 

global:
  name: consul
  datacenter: dc1
  tls:
    # If true, the Helm chart will enable TLS for Consul
    # servers and clients and all consul-k8s-control-plane components, as well as generate certificate
    # authority (optional) and server and client certificates.
    # This setting is required for [Cluster Peering](https://developer.hashicorp.com/consul/docs/connect/cluster-peering/k8s).
    enabled: true
  acls:
    # If true, the Helm chart will automatically manage ACL tokens and policies
    # for all Consul and consul-k8s-control-plane components.
    # This requires Consul >= 1.4.
    manageSystemACLs: true
connectInject:
  # True if you want to enable connect injection. Set to "-" to inherit from
  # global.enabled.
  enabled: false
client:
  # If true, the chart will install all
  # the resources necessary for a Consul client on every Kubernetes node. This _does not_ require
  # `server.enabled`, since the agents can be configured to join an external cluster.
  # @type: boolean
  enabled: true
server:
  replicas: 2
  #storage: 1Gi
  #storageClass: openebs-rwx

tests:
  enabled: false

ui:
  ingress:
    # This will create an Ingress resource for the Consul UI.
    # @type: boolean
    enabled: true

    # Optionally set the ingressClassName.
    ingressClassName: "nginx"

    # pathType override - refer to: https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
    pathType: Prefix

    # hosts is a list of host name to create Ingress rules.
    #
    # ```yaml
    # hosts:
    #   - host: foo.bar
    #     paths:
    #       - /example
    #       - /test
    # ```
    #
    # @type: array<map>
    hosts:
      - paths:
          - /ui
          - /v1
    annotations: |
      nginx.ingress.kubernetes.io/ssl-redirect: "false"

这个执行过程有点复杂。

只是启动 consul-server,  就需要token 等。这借助  consul-k8s-control-plane 这个工具。

kubectl  run vvv2 -it --rm --image=hashicorp/consul-k8s-control-plane:1.3.0 --command -- /bin/sh   

可以看看这个工具的功能。