Created
July 16, 2019 13:05
-
-
Save LeoCavaille/3dbbe62fa3e0363f77b0c08e7d50374b to your computer and use it in GitHub Desktop.
Emergency scripts for Katacoda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: Remember the last step number you were working on Katacoda and | |
# if you're stuck you can reset the env by pressing the "shut down" button | |
# then refresh and: | |
# * set your Datadog API key below | |
# * set your Datadog APP key if you were after step 16 as well | |
# * paste all the commands up to the step you were at before | |
# FIRST SET YOUR API KEY (AND APP KEY) | |
export DD_API_KEY=<your-api-key> | |
export DD_APP_KEY=<YOUR_APP_KEY> | |
# step 1 | |
# step 2 | |
# step 3 | |
kubectl create secret generic datadog-api-key --from-literal=token=$DD_API_KEY | |
kubectl create secret generic datadog-auth-token --from-literal=token=$(openssl rand -hex 16) | |
# step 4 | |
kubectl apply -f assets/02-datadog-agent | |
# step 5 | |
# step 6 | |
kubectl patch daemonset datadog-agent --patch "$(cat assets/04-datadog-agent-everywhere/tolerate-all.patch.yaml)" | |
# step 7 | |
# step 8 | |
kubectl apply -f assets/07-datadog-ksm | |
# step 9 | |
kubectl patch daemonset datadog-agent --patch "$(cat assets/08-datadog-logs/enable-logs.patch.yaml)" | |
# step 10 | |
kubectl patch daemonset datadog-agent --patch "$(cat assets/08-datadog-logs/rolling-update.patch.yaml)" | |
# step 11 | |
kubectl apply -f assets/10-live-tail/log-a-lot.yaml | |
kubectl scale deployment log-a-lot --replicas 30 | |
kubectl scale deployment log-a-lot --replicas 1 | |
# step 12 | |
# step 13 | |
kubectl apply -f assets/10c-deploy-cluster-agent/cluster-agent-manifests | |
kubectl patch daemonset datadog-agent --patch "$(cat assets/10c-deploy-cluster-agent/enable-dca.patch.yaml)" | |
# step 14 | |
# step 15 | |
# step 16 | |
kubectl apply -f assets/11-control-plane/static-pods-discovery.yaml | |
curl -s -o /dev/null -X POST -H "Content-type: application/json" \ | |
-d @assets/11-control-plane/control_plane_json.json \ | |
"https://api.datadoghq.com/api/v1/dashboard?api_key=${DD_API_KEY}&application_key=${DD_APP_KEY}" | |
# step 17 | |
kubectl -n kube-system patch daemonset kube-proxy --patch "$(cat assets/12-kube-proxy/datadog-autodiscovery.patch.yaml)" | |
# step 18 | |
# step 19 | |
kubectl apply -f assets/14-audit-logs/configmap.yaml | |
kubectl patch daemonset datadog-agent --patch "$(cat assets/14-audit-logs/patch-daemonset-audit-logs.yaml)" | |
# step 20 | |
# step 21 | |
# here you'd need to go through the datadog audit logs setup | |
# step 22 | |
# step 23 | |
# step 24 | |
kubectl apply -f assets/apps/manifests/ | |
# step 25 | |
kubectl patch deployment espresso --patch="$(cat assets/apps/fixes/espresso-fix.yaml)" | |
# step 26 | |
kubectl patch deployment macchiato --patch="$(cat assets/apps/fixes/macchiato-fix.yaml)" | |
# step 27 | |
kubectl patch deployment pod-probes --patch="$(cat assets/apps/fixes/pod-probes-liveness-fix.yaml)" | |
# step 28 | |
kubectl patch deployment pod-probes --patch="$(cat assets/apps/fixes/pod-probes-readiness-fix.yaml)" | |
# step 29 | |
kubectl patch cronjob americano-job --patch="$(cat assets/apps/fixes/americano-fix.yaml)" | |
# step 30 | |
kubectl patch clusterroles pod-lister --patch="$(cat assets/apps/fixes/rbac-fix.yaml)" | |
# step 31 | |
kubectl patch deployment pod-lister --patch="$(cat assets/apps/fixes/pod-lister-fix.yaml)" | |
# step 32 | |
# step 33 | |
# step 34 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment