Practice Test - Namespaces
Solutions to practice test for namespaces
-
How many Namespaces exist on the system?
```
kubectl get namespace
```
Count the number of namespaces (if any)
-
How many pods exist in the research namespace?
```
kubectl get pods --namespace=research
```
Count the number of pods (if any)
-
Create a POD in the finance namespace.
```
kubectl run redis --image=redis --namespace=finance
```
-
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
```
-
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
```
-
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.
-
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