Perf and kallsyms in a GKE Ephemeral container

32 views Asked by At

I'd like to build an Ephemeral container where I can attach perf, bpftrace, or gdb to a running process. It would be helpful to get the kernel symbols; however, they are all "zeroed" in /proc/kallsyms, and there seems to be no way to get them from the underlying ContainerOS.

Is it just verboten? Am I beating my head against the proverbial brick wall??

1

There are 1 answers

1
Ron Etch On

You can try the following link to create a privileged pod or deployment that is allowed in securityContext as follows:

apiVersion: v1
kind: Pod
metadata:
  name: proc-writer
  labels:
    app: proc-writer
spec:
  nodeName: "${NODE_NAME}"
  volumes:
  - name: host-proc
    hostPath:
      path: /proc
  containers:
  - name: alpine
    image: alpine:latest
    command: 
      - "sh"
      - "-c"
      - >
        while true; do
          sleep 3600;
        done
    securityContext:
      privileged: true
    volumeMounts:
        - mountPath: /host-proc
          name: host-proc