Kubernetes is an open-source container-orchestration system for automating computer application deployment, scaling, and management.
Use kubectl commands
The kubectl command line tool lets you control Kubernetes clusters. For configuration, kubectl looks for a file named config in the $HOME/.kube directory. You can specify other kubeconfig files by setting the KUBECONFIG environment variable or by setting the --kubeconfig flag.
watch 'kubectl get pods --sort-by=.status.startTime | tail -50'
Get all pods that are not in "Running" state
watch 'kubectl get pods | grep -v Running'
Get logs for pods
# by pod name
kubectl logs -f demo-889bb54fc-4brqx
# by label
kubectl logs -f -l app=demo
# by deployment
kubectl -n kube-system logs -f deployment.apps/cluster-autoscaler
Delete pod in case it is stuck in "terminating"
kubectl get namespace instana-agent -o json > instana-agent.json
# Remove "kubernetes" from the finalizers array in instana-agent.json
# Execute cleanup command
kubectl replace --raw "/api/v1/namespaces/instana-agent/finalize" -f ./instana-agent.json
Port Forwarding
kubectl port-forward --namespace demo deployment/component 8600:8600
# afterwards you can access the pod locally via the forwarded port 8600
curl localhost:8600/...
After that you can exec different commands from inside the dnsutils pod to test DNS resolution. In the example below the demo-reader is running as a headless service with 2 replica. Using nslookup we can verify that we get 2 IP addresses.