configmap

当我们有多个微服务,需要共享一些配置的时候,我们可以使用 configmap来进行配置

apiVersion: v1
kind: ConfigMap
namespace: malema
metadata:
  name: "web"
data:
  APPINSIGHTS_INSTRUMENTATIONKEY: b0f38ecf-c45e-48e1-ba06-cb2d1133cab6
  ConnectionStrings__Malema: xxx

可以在deployment 这边引用它 envFrom

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: web 
  name: web
  namespace: malema 
spec:
  replicas: 2 
  selector:
    matchLabels:
      app: web 
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: web
          ports:
            - containerPort: 80 
          envFrom:
            - configMapRef:
                name: malema #可以写多个。后面的会把前面的给覆盖
            - configMapRef:
                name: web #可以写多个。后面的会把前面的给覆盖
          image: malema-docker.pkg.coding.net/malema/malema/malema-web:72 
          imagePullPolicy: IfNotPresent
          readinessProbe: 
            httpGet:
              path: /health
              port: 80
            initialDelaySeconds: 5
            periodSeconds: 10
            timeoutSeconds: 5
      imagePullSecrets:
        - name: registrykeymalema 
下一篇:aks ip 白名单
最近更新的
...