-
Notifications
You must be signed in to change notification settings - Fork 0
/
multipass-demo.txt
56 lines (44 loc) · 1.75 KB
/
multipass-demo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
## prep multipass ubuntu instance
bash multipass-setup.sh
## shell into the multipass instance
multipass shell ubuntu-multipass
## create 2 worker node kind cluster with a feature gate enabled
docker ps
time (kind create cluster --config ~/multipass-kind-2worker-ephemeral-config.yaml --image kindest/node:v1.16.3 --wait 5m && kubectl wait --timeout=5m --for=condition=Ready nodes --all)
docker ps
## view cluster status
kubectl get no
kubectl get po -A
## try to deploy old deployment spec
kubectl apply -f multipass-example-deploy.yaml
kubectl convert -f multipass-example-deploy.yaml | kubectl apply -f -
## deploy a minimal pod
kubectl apply -f ~/multipass-example-pod.yaml && kubectl wait --for=condition=ready --timeout=30s pod/example-pod
## jump into the pod and see what limited utilities are present
kubectl exec -it example-pod sh
curl
tcpdump
openssl
file
exit
## inject the ephemeral container
kubectl replace --raw /api/v1/namespaces/default/pods/example-pod/ephemeralcontainers -f ~/multipass-example-debug.json
## check state of the add'l container
watch kubectl get pods example-pod -o jsonpath="{.status.ephemeralContainerStatuses[0].state}" && echo
kubectl describe po example-pod
## once running, attach to pod via add'l container and see debug utils
kubectl attach -it example-pod -c debugger
curl
tcpdump
openssl
file
tcpdump -i any -c20 -nn -vv
kubectl run -i --rm --restart=Never minideb-extras --image=bitnami/minideb-extras -- sh -c "curl -vvv http://$(kubectl get po example-pod -o jsonpath='{.status.podIP}')"
exit
## notice ephemeral container is gone and can no longer be attached
kubectl describe po example-pod
kubectl attach -it example-pod -c debugger
## exit multipass shell
exit
## cleanup
multipass delete ubuntu-multipass && multipass purge