iximiuz / client-go-examples

Collection of mini-programs demonstrating Kubernetes client-go usage.
https://labs.iximiuz.com/playgrounds/k8s-client-go/
Apache License 2.0
1.05k stars 135 forks source link

How to exec on pod #16

Open BlueprintCEO opened 3 months ago

BlueprintCEO commented 3 months ago

It would be a nice example how to exec on a existing pod and run a curl from within it

Something like the following command :

kubectl exec -n nice_namespace nice_pod-8447f7cc77-jxz7d -it -- /bin/bash

iximiuz commented 2 months ago

Yeah, it's been on my list for a while :) I should definitely come up with a minimal possible example of kubect exec-like functionality. Meanwhile, you can check this piece of code - it's doing pretty much that https://github.com/iximiuz/cdebug/blob/main/cmd/exec/exec_kubernetes.go.