Please answer the quiz and click the "Test" button at the bottom right.This quiz is part of the DevOpsTheHardWay course.
Kubernetes - Cluster setup and introduction - multichoice questions
Question 1
What are possible options to provide the my-configs.yaml
kubeconfig to kubectl
command?
- Using
KUBECONFIG=my-configs.yaml
environment variable. - Using
--kubeconfig my-configs.yaml
flag in thekubectl
. - Placing the
my-configs.yaml
file into~/kubeconfig
directory. - Placing the
my-configs.yaml
file into~/kube/config
directory.
Question 2
Below are two example kubeconfig YAML files:
# kubeconfig1.yaml
apiVersion: v1
kind: Config
clusters:
- name: cluster1
cluster:
server: https://cluster1.example.com
certificate-authority-data: <base64-encoded-ca-cert>
users:
- name: user1
user:
client-certificate-data: <base64-encoded-client-cert>
client-key-data: <base64-encoded-client-key>
contexts:
- name: overlapping-context
context:
cluster: cluster1
user: user1
namespace: namespace1
And
# kubeconfig2.yaml
apiVersion: v1
kind: Config
clusters:
- name: cluster2
cluster:
server: https://cluster2.example.com
certificate-authority-data: <base64-encoded-ca-cert>
users:
- name: user2
user:
client-certificate-data: <base64-encoded-client-cert>
client-key-data: <base64-encoded-client-key>
contexts:
- name: overlapping-context
context:
cluster: cluster2
user: user2
namespace: namespace2
Now, let's set the KUBECONFIG environment variable to include both kubeconfigs:
export KUBECONFIG=kubeconfig1.yaml:kubeconfig2.yaml
Given the below commands:
kubectl config set-context overlapping-context
kubectl run nginx --image=nginx --restart=Never
In which namespace the nginx would be created?
-
default
-
namespace2
-
namespace1
- Can not be determined.
Question 3
How many Pods are running in the kube-system
namespace on a fresh installation of Kubernetes version 1.25.8
using Minikube?
- 0
- 7
- 5
- 4
Question 4
Which of the following components are part of the Control Plane?
- API Server
- kubelet
- Node
- kube-proxy
- scheduler
- etcd
Question 5
In the kubeconfig file, what does the server: URL
point to? Choose the accurate answer
- The URL address of the cluster.
- The URL address of the API server.
- The URL address of one of the cluster nodes.
- The URL address of the control plane machine.
Question 6
Choose the correct sentence
- The API server is a component running as a Linux service on the control-plane machine
- The API server itself is running as a Pod in the cluster, on the control-plane node.
- The API server is running in the cluster control-plane node, but not as a Pod.
- None of the above.
Question 7
What namespace does kube-scheduler
Pod reside in?
-
default
-
minikube
-
kube-system
-
kubernetes-dashboard
Question 8
In a case where the Kubernetes control plane node is unavailable, would that impact containers running on the worker nodes?
- Worker node would stop functioning, as so containers.
- Containers will keep running, but communicating with the API server and cluster orchestration would work.
- Containers will keep running, one of the worker nodes would be the master now.
- None of the above.
Question 9
Assume 15 Kubernetes cluster running in different regions in AWS. You want to run a kubectl
command, but before, you want to make sure your command will be executed on the right cluster.
How can you ensure that?
-
kubectl get context
-
kubectl config current-context
-
kubectl config get-context
-
minikube status
Question 10
ssh
ing into one of the cluster worker nodes, and executing the docker ps
command would print all running containers on that node.
Here is an example of a container name:
k8s_POD_currencyservice-79b446569d-n6mtq_default_660fbffb-df77-422d-a408-8bc73e5a77d5_0
What information can we extract from the container name?
- The ports the container is listening to.
- The namespace in which the pod belongs.
- The image name of this running container.
- This container is a pod in a k8s cluster.
Question 11
A k8s developer wanted to review all existed pods in the cluster. She performed:
kubectl get pods
- The command is good.
- Adding the
-n kube-system
flag will list all pods. - The command lists only some of the pods in the cluster.
- None of the above.
Question 12
In a Kubernetes kubeconfig file, the certificate-authority
field, under cluster
, is used for:
- Certificate authority (CA) file that the Kubernetes API server should use to verify the authenticity of the client (
kubectl
). - Certificate authority (CA) file that the Kubernetes client (
kubectl
) should use to sign the Kubernetes API server certificate. - Certificate authority (CA) file that the Kubernetes API server should use to sign the authenticity of the client (
kubectl
). - Certificate authority (CA) file that the Kubernetes client (
kubectl
) should use to verify the authenticity of the Kubernetes API server.
Question 13
In a Kubernetes kubeconfig file, the client-certificate
and the client-key
fields, under user
, is used to:
- Specify the API server certificate and private key that the Kubernetes uses to authenticate itself to the client (
kubectl
). - Specify the client certificate and private key that the Kubernetes client (
kubectl
) uses to authenticate itself to the Kubernetes API server when making requests. - Specify the client certificate and private key that the Kubernetes client (
kubectl
) uses to authenticate itself to Minikube. - None of the above.