Skip to content

Commit

Permalink
for lecture6: add ephemeral container debug
Browse files Browse the repository at this point in the history
  • Loading branch information
entlein committed Apr 4, 2024
1 parent 292a808 commit e4b889f
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions kind/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,30 @@ tasks:

envsubst:
cmds:
- export pacman={{.pacman}}
- envsubst < ../kubernetes/persistentvolumeclaim/mongo-pvc.txt.yaml > manifests/mongo-pvc.yaml
- envsubst < ../kubernetes/security/secret.txt.yaml > manifests/secret.yaml
- |
export PACMAN="{{.pacman}}"
sed "s/\$pacman/$PACMAN/g" ../kubernetes/persistentvolumeclaim/mongo-pvc.txt.yaml > manifests/mongo-pvc.yaml
sed "s/\$pacman/$PACMAN/g" ../kubernetes/security/secret.txt.yaml > manifests/secret.yaml
silent: false

deploy-manifests:
cmds:
- for i in manifests/*; do kubectl apply -f $i; done
- for i in manifests/*; do kubectl apply -f $i -n {{.pacman}}; done

delete-manifests:
cmds:
- for i in manifests/*; do kubectl delete -f $i; done
- for i in manifests/*; do kubectl delete -f $i -n {{.pacman}}; done

port-forward:
cmds:
- kubectl port-forward -n {{.pacman}} service/pacman 8000:80
silent: false

ephemeral-debug:
cmds:
- |
export POD_NAME=$(kubectl get pods -n {{.pacman}} -l name=mongo -o jsonpath="{.items[0].metadata.name}")
kubectl debug -n {{.pacman}} -it $POD_NAME --image=alpine -- bash
#read the secret.yaml to understand where these values are coming from:
#kubectl debug -n {{.pacman}} -it $POD_NAME --image=mongo -- sh -c "mongosh mongodb://blinky:pinky@localhost:27017/pacman"
silent: false

0 comments on commit e4b889f

Please sign in to comment.