./scripts/create-kind-cluster-with-registry.shcd $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 consulbrew tap hashicorp/tap
brew install hashicorp/tap/consul-k8s
consul-k8s install -config-file=./config/values.yamlbrew install consulexport 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=falseIn a new window, port forward to allow the CLI to connect to consul.
kubectl port-forward svc/consul-ui --namespace consul 8501:443consul license getkubectl apply -f ./config/heartbeat.yaml && kubectl apply -f ./config/dashboard.yamlkubectl port-forward svc/dashboard --namespace default 9002:9002Open http://localhost:9002 in your browser, and you should that there are no current requests reaching the heartbeat service.
kubectl apply -f ./config/intentions.yamlEnsure 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.yamlOr 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.hclNote 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.yamlOr alternatively:
consul config write ./config/fault-injection/hcl/heartbeat-fault-injection.hclNote 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.yamlOr alternatively:
consul config write ./config/fault-injection/hcl/heartbeat-delay-injection.hclNote that statuses are all 200 now, however, 50% of requests are delayed by 500 milliseconds.
kind delete cluster -n dc1