Question 1 — How many namespaces exist on the system?
List all namespaces with:Question 2 — How many pods exist in the research namespace?
To list pods in a specific namespace, use--namespace or the short -n flag:
research namespace:
research namespace: dna-1 and dna-2.
Tip: use kubectl describe pod <pod-name> -n research and kubectl logs <pod-name> -n research to investigate CrashLoopBackOff or other pod issues.
Question 3 — Create a pod in the finance namespace using the given spec
To create a single Pod namedredis from the redis image in the finance namespace, you can use kubectl run. Newer kubectl versions default to creating a Deployment unless you explicitly request a Pod object by setting --restart=Never:
kubectl run behavior changed in newer versions: without
--restart=Never it may create a Deployment instead of a Pod. Use --restart=Never to ensure a Pod is created, or provide a Pod manifest and apply it with kubectl apply -f <pod-manifest.yaml>.Additional verification examples
Below are example commands to show how to inspect resources in other namespaces. These help illustrate how Services and Pods appear when scoped to a namespace. Example: list pods in themarketing namespace
marketing namespace
dev namespace
- kubectl basics: https://kubernetes.io/docs/reference/kubectl/overview/
- kubectl run docs: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run