更改index.html nginx kubernetes部署 [英] Change index.html nginx kubernetes deployment

查看:80
本文介绍了更改index.html nginx kubernetes部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个部署:

我能够在其中一个Pod上编辑索引页面,但是如何将其提交到部署映像?因此,当我缩放应用程序时,所有新的Pod都将具有相同的图像,并已编辑索引.

I was able to edit the index page at one of my pods, but how can I commit it to the deployment image? So when I scale the application all new pods will have the same image with index edited.

推荐答案

对我有用

apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    name: nginx
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
      - containerPort: 80
    volumeMounts:
      - mountPath: /usr/share/nginx/html/index.html
        name: nginx-conf
        subPath: index.html
  volumes:
    - name: nginx-conf
      configMap:
        name: nginx-index-html-configmap

和简单的configmap具有:

And simple configmap with:

data:
<html></html>

这篇关于更改index.html nginx kubernetes部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆