我对 Kubernetes 还很陌生,我遇到了这个问题,pod 不断重新启动。我在 Google 上搜索了一下,但没有找到太多帮助。我只有一个简单的 Apache 部署,没有什么特别的。
apiVersion: apps/v1
kind: Deployment
metadata:
name: website-deployment
labels:
app: website
spec:
replicas: 2
selector:
matchLabels:
app: website
template:
metadata:
labels:
app: website
spec:
containers:
- name: apache
image: httpd:2.4.57
ports:
- containerPort: 80
这是来自 pod 的日志
root@kubemaster:~# kubectl logs website-deployment-cc57f5644-2kg7v -p
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.240.0.110. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.240.0.110. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 10 19:16:24.132794 2023] [mpm_event:notice] [pid 1:tid 140595614588224] AH00489: Apache/2.4.57 (Unix) configured -- resuming normal operations
[Mon Apr 10 19:16:24.133016 2023] [core:notice] [pid 1:tid 140595614588224] AH00094: Command line: 'httpd -D FOREGROUND'
[Mon Apr 10 19:22:42.890545 2023] [mpm_event:notice] [pid 1:tid 140595614588224] AH00492: caught SIGWINCH, shutting down gracefully
如您所见,它运行了几分钟,然后收到 SIGWINCH 事件,这会触发 pod 进入 CrashLoopBackOff 状态,然后重新启动。然后这种情况会一直循环发生。
我使用 Ubuntu 22.04 作为主服务器,并且有 2 个 Ubuntu 22.04 作为节点。
谢谢