0
0
Kubernetesdevops~20 mins

kubectl CLI installation and configuration in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kubectl Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Check kubectl version output
What is the output of the command kubectl version --client --short immediately after a successful kubectl installation?
Kubernetes
kubectl version --client --short
AClient Version: v1.27.0
BError: unknown command "version" for "kubectl"
CClient Version: 1.27
DThe connection to the server localhost:8080 was refused
Attempts:
2 left
💡 Hint
The command shows the client version in a short format.
Configuration
intermediate
1:30remaining
Correct kubeconfig file location
After installing kubectl, where should the default kubeconfig file be placed for kubectl to automatically use it?
A/etc/kubernetes/kubeconfig.yaml
B~/.kube/config
C/usr/local/bin/kubeconfig
D~/.kubectl/config.yaml
Attempts:
2 left
💡 Hint
kubectl looks for the config file in a hidden directory inside your home folder.
Troubleshoot
advanced
2:00remaining
Diagnose kubectl connection error
You run kubectl get pods and get the error: The connection to the server localhost:8080 was refused. What is the most likely cause?
Akubectl binary is corrupted and cannot connect
BThe Kubernetes API server is running but rejecting requests
Ckubectl is not configured with a valid kubeconfig file or cluster context
DThe pod names are misspelled in the command
Attempts:
2 left
💡 Hint
This error usually means kubectl tries to connect to localhost because it has no cluster info.
🔀 Workflow
advanced
1:30remaining
Set a specific context for kubectl
Which command correctly sets the current context to production-cluster in kubectl?
Akubectl config set current-context production-cluster
Bkubectl set context production-cluster
Ckubectl switch context production-cluster
Dkubectl config use-context production-cluster
Attempts:
2 left
💡 Hint
The command uses 'config' and 'use-context' keywords.
Best Practice
expert
2:30remaining
Secure kubectl configuration best practice
What is the best practice to securely manage kubectl access credentials on a shared workstation?
AStore kubeconfig files with minimal permissions and use environment variables to specify them
BKeep kubeconfig files in a public folder for easy access
CEmbed credentials directly in deployment YAML files
DShare a single kubeconfig file among all users without restrictions
Attempts:
2 left
💡 Hint
Think about file permissions and environment isolation.