Skip to content

Instantly share code, notes, and snippets.

@rgl
Created August 20, 2022 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgl/7bf57b566c04886e572d730ddeed9c9c to your computer and use it in GitHub Desktop.
Save rgl/7bf57b566c04886e572d730ddeed9c9c to your computer and use it in GitHub Desktop.
wip talos poke
kubectl -n kube-system delete pod/poke
kubectl -n kube-system apply -f - <<'EOF'
# see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#pod-v1-core
apiVersion: v1
kind: Pod
metadata:
  name: poke
spec:
  nodeSelector:
    kubernetes.io/hostname: cp1
  containers:
    - name: poke
      image: debian:11-slim
      args:
        - bash
        - -c
        - sleep infinity
      securityContext:
        privileged: true
      volumeMounts:
        - name: host
          mountPath: /host
  volumes:
    - name: host
      hostPath:
        path: /
  tolerations:
    - effect: NoSchedule
      key: node-role.kubernetes.io/control-plane
      operator: Exists
EOF
kubectl -n kube-system exec -it pod/poke -- bash
apt-get update
apt-get install -y wget
cd /usr/local
wget https://github.com/containerd/containerd/releases/download/v1.6.8/containerd-1.6.8-linux-amd64.tar.gz
tar xf containerd-1.6.8-linux-amd64.tar.gz
function query-containerd {
  ctr ns ls -q | while read ns; do ctr -n $ns images ls -q | while read n; do echo "image $ns $n"; done; done
  ctr ns ls -q | while read ns; do ctr -n $ns containers ls -q | while read n; do echo "container $ns $n"; done; done
}
# query the user containerd.
export CONTAINERD_ADDRESS=/host/run/containerd/containerd.sock
query-containerd
# query the system containerd.
export CONTAINERD_ADDRESS=/host/system/run/containerd/containerd.sock
query-containerd
kubectl -n kube-system describe pod/poke
kubectl -n kube-system delete pod/poke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment