0

我们的 nginx 控制器不支持 windows 7 系统的 SSL。我们更新了nginx.confKubernetes Nginx pods 文件中的密码套件,它开始工作了。

现在的问题是,每当服务重新启动或 pod 重新启动时,nginx.conf文件都会重置为默认值。

我们如何nginx.conf永久设置文件?

4

1 回答 1

1

为您的 nginx.conf 创建一个配置映射并将其附加到您的 pod 的特定位置。

通过运行以下命令创建配置映射。

kubectl create configmap nginx-conf --from-file=nginx.conf

并将其附加在特定目录中。

apiVersion: v1
kind: Pod
metadata:
  name: test
spec:
  containers:
    - name: test-container
      image: k8s.gcr.io/busybox
      command: [ "/bin/sh", "-c", "ls /etc/config/" ]
      volumeMounts:
      - name: nginx-config
        mountPath: /etc/nginx/
  volumes:
    - name: nginx-config
      configMap:
        # Provide the name of the ConfigMap containing the files you want
        # to add to the container
        name: nginx-config //your config map name here
  restartPolicy: Never
于 2021-06-14T07:28:03.213 回答