Code Monkey home page Code Monkey logo

helm-upgrade-configmap-simple's Introduction

helm-upgrade-configmap-simple

Helm更新使用ConfigMap的例子

通常情况下,configmaps 或 secrets 被作为配置文件注入容器中。根据应用程序的不同,可能需要重新启动才能使用后续更新 helm upgrade,但如果 deployment spece 本身未更改,则应用程序会一直以旧配置运行,导致 deployment 不一致。

该 sha256sum 函数可用于确保在一个文件发生更改时更新 deployment 的注释部分:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-deployment
  template:
    metadata:
      labels:
        app: nginx-deployment
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
        volumeMounts:
        - name: config-volume
          mountPath: /etc/nginx/conf.d/
      volumes:
        - name: config-volume
          configMap:
            name: nginx-cm
            

使用

# install
helm install nginx-cm helm-cm1-master/

# 更改default.conf

# upgrade
helm upgrade --recreate-pods  nginx-cm helm-cm1-master/

helm-upgrade-configmap-simple's People

Contributors

pkeropen avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

breakaleg111

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.