Skip to content

Latest commit

 

History

History
69 lines (51 loc) · 1.57 KB

11.Practice-Test-Secrets.md

File metadata and controls

69 lines (51 loc) · 1.57 KB

Practice Test - Secrets

Solutions for pracice test - Secrets

  • Run the command 'kubectl get secrets' and count the number of pods.

    ``` $ kubectl get secrets ```
  • Run the command 'kubectl get secrets' and look at the DATA field

    ``` $ kubectl get secrets ```
  • Run the command 'kubectl describe secret'

    ``` $ kubectl describe secret ```
  • Run the command 'kubectl describe secret'

    ``` $ kubectl describe secret ```
  • We have already deployed the required pods and services. Check out the pods and services created. Check out the web application using the 'Webapp MySQL' link above your terminal, next to the Quiz Portal Link.

  • Run command kubectl create secret generic db-secret --from-literal=DB_Host=sql01 --from-literal=DBUser=root --from-literal=DB_Password=password123

    ``` $ kubectl create secret generic db-secret --from-literal=DB_Host=sql01 --from-literal=DB_User=root --from-literal=DB_Password=password123 ```
  • Check Answer at /var/answers/answer-webapp.yaml

    ``` $ kubectl get pod webapp-pod -o yaml > web.yaml $ kubectl delete pod webapp-pod ```

    Update web.yaml with secret section

    envFrom:

    • secretRef: name: db-secret
    ``` $ kubectl create -f web.yaml ```
  • View the web application to verify it can successfully connect to the database