How to ssh into a Traefik pod?

冷暖自知 提交于 2021-02-16 14:52:38

问题


I am using GKE. I've launched the following traefik deployment through kubectl:

https://github.com/containous/traefik/blob/master/examples/k8s/traefik-deployment.yaml

The pod runs on the kube-system namespace. I'm not able to ssh into the pod.

kubectl get po -n kube-system traefik-ingress-controller-5bf599f65d-fl9gx 1/1 Running 0 30m

kubectl exec -it traefik-ingress-controller-5bf599f65d-fl9gx -n kube-system -- '\bin\bash' rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"\\\\bin\\\\bash\": executable file not found in $PATH" command terminated with exit code 126

Am I missing something? The same thing for '-- sh' too.


回答1:


rather use forward slashed / (your example has a backslash) such as in

kubectl exec -it traefik-ingress-controller-5bf599f65d-fl9gx -n kube-system -- '/bin/bash'

If this does still not work, try a different shell such as

kubectl exec -it traefik-ingress-controller-5bf599f65d-fl9gx -n kube-system -- '/bin/sh'



回答2:


So, apparently the default traefik image is an amd64 version. I had to use the alpine version to ssh into it using: kubectl exec -it _podname_ -- sh




回答3:


It seems that this here is the right answer. You cannot exec a shell into the traefik container using the default image, you must use the alpine one.



来源:https://stackoverflow.com/questions/55115001/how-to-ssh-into-a-traefik-pod

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!