简体   繁体   English

在 k8s 上的“Traefik”Pod 中获取运行容器的 Shell

[英]Get a Shell to running container inside "Traefik" Pod on k8s

We tried attaching a shell to container inside "Traefik" Pod using following command but it didn't work.我们尝试使用以下命令将外壳附加到“Traefik”Pod 内的容器,但没有奏效。 Just FYI, we used helm chart to install Traefik on our k8s cluster.仅供参考,我们使用 helm chart 在我们的 k8s 集群上安装 Traefik。

kubectl exec -it <traefik Pod name> -- /bin/sh

tried this too but no success - kubectl exec -it <traefik Pod name> -- /bin/bash也尝试过,但没有成功 - kubectl exec -it <traefik Pod name> -- /bin/bash

Any help in this context will be appreciated.在这方面的任何帮助将不胜感激。 Thanks.谢谢。

Traefik 1.7 uses a FROM scratch container image that has only the Traefik executable and some support files. Traefik 1.7 使用一个FROM scratch容器镜像,它只有 Traefik 可执行文件和一些支持文件。 There is no shell.没有外壳。 You would have to switch to the -alpine variant of the image.您必须切换到图像的-alpine变体。 For 2.x it looks like they use Alpine by default for some reason.对于 2.x,出于某种原因,他们似乎默认使用 Alpine。

You can change the time zone by mounting volume您可以通过安装音量来更改时区

volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"

Ref: https://bobcares.com/blog/change-time-in-docker-container/参考: https : //bobcares.com/blog/change-time-in-docker-container/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 K8S iptables 与 pod 内的容器之间的关系 - relationship between K8S iptables and the one of a container inside a pod 从内部运行的应用程序读取k8s pod的IP - Read IP of k8s pod from application running inside it 如何在 POD 内获取 shell 而不是在 POD 内运行的容器 - How to get a shell inside a POD instead of container running inside the POD 是否可以像执行到 docker 容器或在 pod 内运行的容器一样执行到 K8s pod? - Is it possible to exec in to a K8s pod the same way we exec in to a docker containers or containers running inside of a pod? 在K8s pod中运行的Logstash容器的http插件要使用什么主机和端口? - What host and port to use for http plugin for a Logstash container running in K8s pod? 为什么这个 curl 从 k8s pod 中容器内的 tmp 获取? - why does this curl fetch from tmp inside container in k8s pod? 从运行在不同 k8s 集群中的 pod 启动不同 k8s 集群中的 pod - Launching a pod in a different k8s cluster from a pod running in a different k8s cluster k8s Pod 1 获取错误 pod 2 的 ip 地址 - k8s Pod 1 get wrong pod 2's ip address 在K8S上安全运行Apache容器 - Securely running an apache container on k8s io.k8s.api.core.v1.PodSecurityContext 中的未知字段“功能”(在容器/k8s pod 中运行 tshark) - unknown field "capabilities" in io.k8s.api.core.v1.PodSecurityContext (running tshark in a container/k8s pod)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM