Vẫn là Bác Ro zo mang đến cho anh em kiến thức thú vị
Mount a secret key as a single file.
Mình có 1 secret với key là .env
Và sau đây là các bạn mount secret vào deployment.
spec: containers: - image: xxxxxxxx.dkr.ecr.us-west-2.amazonaws.com/devops/kang-tva:1797 imagePullPolicy: Always name: kang-tva ports: - containerPort: 80 name: http protocol: TCP resources: {} securityContext: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /var/www/html/database/sqlite-data name: storage - mountPath: /var/www/html/.env name: kang-env subPath: .env dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler securityContext: {} serviceAccount: kang-tva serviceAccountName: kang-tva terminationGracePeriodSeconds: 30 volumes: - name: storage persistentVolumeClaim: claimName: kang-tva-pvc - name: kang-env secret: defaultMode: 420 items: - key: .env path: .env secretName: kang-env
Refer to:
https://techsquad.rocks/en/blog/mounting-secrets-in-kubernetes