[英]Why when I restart a pod in Kubernetes does the service I have in my container go down?
I have created a pod with an apache service inside, and when I restart a node the services that are inside my pods are automatically deactivated and I have to activate them again manually with the /etc/init.d/apache2 start command.我创建了一个带有 apache 服务的 pod,当我重新启动一个节点时,我的 pod 中的服务会自动停用,我必须使用 /etc/init.d/apache2 start 命令手动再次激活它们。 I don't know why this error happens and what can I do to solve it我不知道为什么会发生此错误以及我该怎么做才能解决它
You need to add command and args in your pod definition that start apache in foreground:您需要在 pod 定义中添加在前台开始 apache 的命令和参数:
apiVersion: v1
kind: Pod
metadata:
name: podname
spec:
containers:
- name: containername
image: yourimage
command: ["apachectl"]
args: ["-D", "FOREGROUND"]
restartPolicy: OnFailure
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.