k8s.github.io

Practice Test - Namespaces

Solutions to practice test for namespaces

  1. How many Namespaces exist on the system? ``` kubectl get namespace ``` Count the number of namespaces (if any)
  2. How many pods exist in the research namespace? ``` kubectl get pods --namespace=research ``` Count the number of pods (if any)
  3. Create a POD in the finance namespace. ``` kubectl run redis --image=redis --namespace=finance ```
  4. Which namespace has the blue pod in it? ``` kubectl get pods --all-namespaces ``` Examine the output. Or use `grep` to filter the results, knowing that `NAMESPACE` is the first result column ``` kubectl get pods --all-namespaces | grep blue ```
  5. Access the Blue web application using the link above your terminal!! Press the `blue-application-ui` button at the top of the terminal. Try the following: ``` Host Name: db-service Host Port: 6379 ```
  6. What DNS name should the Blue application use to access the database db-service in its own namespace - marketing? > db-service To access services in the same namespace, only the host name part of the fully qualified domain name (FQDN) is required.
  7. What DNS name should the Blue application use to access the database db-service in the dev namespace? Either FQDN > db-service.dev.svc.cluster.local Or, it is sufficient just to append the namespace name > db-service.dev