You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
apiVersion: v1kind: Secretmetadata:
name: wordpress_secretdata:
WORDPRESS_DB_HOST: # base64 encoded host string and likewise in other fields as wellWORDPRESS_DB_USER:
WORDPRESS_DB_PASSWORD:
WORDPRESS_DB_NAME:
type: Opaque
now it is time to enter them in to deployment file
apiVersion: apps/v1kind: Deploymentmetadata:
name: Wordpress-deploymentspec:
selector:
matchLabels:
type: webappreplicas: 2template:
metadata:
labels:
type: webappspec:
containers:
- name: wordpressimage: wordpressports:
- containerPort: 80env:
- name: WORDPRESS_DB_HOST # name of your secet that container will store as env variablevalueFrom:
secretKeyRef:
name: wordpress_secret # name of your secret object that you created in k8, this will relate your secret file to delployment filekey: WORDPRESS_DB_HOST # key of your secret that you created inside secret object file
- name: WORDPRESS_DB_USERvalueFrom:
secretKeyRef:
name: wordpress_secretkey: WORDPRESS_DB_USER
- name: WORDPRESS_DB_PASSWORDvalueFrom:
secretKeyRef:
name: wordpress_secretkey: WORDPRESS_DB_PASSWORD
- name: WORDPRESS_DB_NAMEvalueFrom:
secretKeyRef:
name: wordpress_secretkey: WORDPRESS_DB_NAME