gpt4 book ai didi

apache - Kubernetes:hostPath 卷未挂载

转载 作者:太空宇宙 更新时间:2023-11-03 13:36:42 26 4
gpt4 key购买 nike

我想使用带 https 的 apache 服务器创建一个网络应用程序,并且我已经使用 letsencrypt 生成了证书文件。我已经验证了 cert.pemchain.pemfullchain.pemprivkey.pem 已存储在主机上。但是,我无法将它们映射到 pod。这是 web-controller.yaml 文件:

apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: web
name: web-controller
spec:
replicas: 2
selector:
name: web
template:
metadata:
labels:
name: web
spec:
containers:
- image: <my-wen-app-image>
command: ['/bin/sh', '-c']
args: ['sudo a2enmod ssl && service apache2 restart && sudo /usr/sbin/apache2ctl -D FOREGROUND']
name: web
ports:
- containerPort: 80
name: http-server
volumeMounts:
- mountPath: /usr/local/myapp/https
name: test-volume
readOnly: false
volumes:
- hostPath:
path: /etc/letsencrypt/live/xxx.xxx.xxx.edu
name: test-volume

kubectl create -f web-controller.yaml 之后,错误日志显示:

AH00526: Syntax error on line 8 of /etc/apache2/sites-enabled/000-default.conf:
SSLCertificateFile: file '/usr/local/myapp/https/cert.pem' does not exist or is empty
Action 'configtest' failed.

这就是为什么我认为问题是证书没有映射到容器中。

谁能帮我解决这个问题?非常感谢!

最佳答案

我想通了:我必须将它挂载到 /etc/letsencrypt/live/host 而不是 /usr/local/myapp/https

这可能不是根本原因,但现在可以了。

关于apache - Kubernetes:hostPath 卷未挂载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37819488/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com