./scripts/create-kind-cluster-with-registry.sh
cd $CONSUL_ENTERPRISE_REPO
make dev-docker
docker tag 'hashicorp/consul-enterprise:local' 'localhost:5001/consul-enterprise:local'
docker push 'localhost:5001/consul-enterprise:local'
cd $CONSUL_FAULT_INJECTION_DEMO_REPO
(cd services && make all)
kubectl create ns consul
# Given consul license in CONSUL_LICENSE env var
kubectl create secret generic consul-ent-license --from-literal="key=${CONSUL_LICENSE}" -n consul
brew tap hashicorp/tap
brew install hashicorp/tap/consul-k8s
consul-k8s install -config-file=./config/values.yaml
brew install consul
export CONSUL_HTTP_TOKEN=$(kubectl get --namespace consul secrets/consul-bootstrap-acl-token --template={{.data.token}} | base64 -d)
export CONSUL_HTTP_ADDR=https://127.0.0.1:8501
export CONSUL_HTTP_SSL_VERIFY=false
In a new window, port forward to allow the CLI to connect to consul.
kubectl port-forward svc/consul-ui --namespace consul 8501:443
consul license get
kubectl apply -f ./config/heartbeat.yaml && kubectl apply -f ./config/dashboard.yaml
kubectl port-forward svc/dashboard --namespace default 9002:9002
Open http://localhost:9002 in your browser, and you should that there are no current requests reaching the heartbeat service.
kubectl apply -f ./config/intentions.yaml
Ensure that the dashboard port-forward is still running, and refresh the page. The dashboard should now show successful requests.
Apply the defaults via either kubectl
or the consul config write
command.
kubectl apply -f ./config/defaults/yaml/mesh-defaults.yaml
kubectl apply -f ./config/defaults/yaml/proxy-defaults.yaml
kubectl apply -f ./config/defaults/yaml/dashboard-defaults.yaml
kubectl apply -f ./config/defaults/yaml/heartbeat-defaults.yaml
Or alternatively:
consul config write ./config/defaults/hcl/mesh-defaults.hcl
consul config write ./config/defaults/hcl/proxy-defaults.hcl
consul config write ./config/defaults/hcl/dashboard-defaults.hcl
consul config write ./config/defaults/hcl/heartbeat-defaults.hcl
Note that if you create the defaults via consul config write
, you will not be able to overwrite them later via kubectl apply
as the reconciler will fail.
The dashboard should now show all requests going through the proxies.
kubectl apply -f ./config/fault-injection/yaml/heartbeat-fault-injection.yaml
Or alternatively:
consul config write ./config/fault-injection/hcl/heartbeat-fault-injection.hcl
Note that 50% of the requests will now have a 500 status code injected from the filter.
kubectl apply -f ./config/fault-injection/yaml/heartbeat-delay-injection.yaml
Or alternatively:
consul config write ./config/fault-injection/hcl/heartbeat-delay-injection.hcl
Note that statuses are all 200 now, however, 50% of requests are delayed by 500 milliseconds.
kind delete cluster -n dc1