troubleshooting-in-kubernetes
Demonstrate various ways to troubleshoot (detect, diagnose, and resolve) problems in Kubernetes
Getting Started
Deploy the CloudFormation infrastructure/cloudformation.json
template. The template creates a user with the following credentials and minimal required permisisons to complete the Lab:
- Username: student
- Password: password
Instructions
-
Connect to the bastion host with SSH agent forwarding
-
Enter the following to enable
kubectl
completions:echo "source <(kubectl completion bash)" >> ~/.bashrc source ~/.bashrc
-
Attempt to list the nodes in the cluster:
kubectl get nodes
-
Copy the kubeconfig from the master node to fix kubectl, entering yes when prompted about the host's authenticity:
mkdir .kube # create the .kube directory master_ip=$(aws ec2 describe-instances --region us-west-2 \ --filters "Name=tag:Name,Values=k8s-master" \ --query "Reservations[*].Instances[*].PrivateIpAddress" \ --output text) # get the master's IP address using the AWS CLI scp -o "ForwardAgent yes" $master_ip:.kube/config .kube/config # secure copy (scp) the kubeconfig file
-
Successfully list the nodes in the cluster:
kubectl get nodes
Cleaning Up
Delete the CloudFormation stack to remove all the resources used in the Lab.