k8s 容器注入 env

容器注入staging,我这里采用的配置中心,通过这个函数来读取不同环境的配置

 

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: boss
  name: boss
  namespace: s2b2c
spec:
  replicas: 1
  selector:
    matchLabels:
      app: boss
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: boss
    spec:
      imagePullSecrets:
      - name: registry-pull-secret
      containers:
        - name: boss
          image: 10.1.234.11/data/boss:v1
          imagePullPolicy: Always
          env:
          - name: "ASPNETCORE_ENVIRONMENT"
            value: "Staging"
          ports:
          - containerPort: 11001
                  
          volumeMounts:
          - name: "appsetting"
            mountPath: /appsetting.toml
            subPath: appsetting.toml
                        
          - name: "priv"
            mountPath: /rsa_1024_priv.pem
            subPath: rsa_1024_priv.pem
       

版权声明:本文为qq_36270681原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。