httpsでapacheサーバーを使用してWebアプリケーションを作成し、letsencryptを使用して証明書ファイルを生成しました。私はすでにcert.pem
,chain.pem
、fullchain.pem
、およびprivkey.pem
がホストマシンに保存されていることを確認しました。しかし、私はそれらをポッドにマップすることはできません。エラーログは言うKubernetes:hostPathボリュームがマウントされない
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.
私は問題は、証明書がコンテナ内にマッピングされていないということだと思う理由です。ここweb-controller.yaml
ファイルです。
誰でも私にこれを助けることができますか?どうもありがとう!
'/ usr/local/myapp/https'にファイルがありますか?そこにフォルダはありますか? SSL設定をコメントアウトして、実際にポッドを実行させてから、 'kubectl exec -it $(kubectl get pods -l name = web -o name | cut -d/-f 2)sh'を使ってシェルとテスト。 – kichik