Prerequisites
kubectl installed and configured.
Access to the Kubernetes cluster via kubeconfig.
Permissions to interact with the required resources.
Optional: Helm installed for managing applications.
Ways to Access Kubernetes Resources
There are multiple methods to access Kubernetes resources, each suited for different use cases:
1. Using kubectl
kubectl is the primary CLI tool for interacting with Kubernetes resources.
a) View Resources
List all pods:
kubectl get pods -n <namespace>
Describe a specific pod:
kubectl describe pod <pod-name> -n <namespace>
Get logs from a pod:
kubectl logs <pod-name> -n <namespace>
Execute commands inside a running pod:
kubectl exec -it <pod-name> -n <namespace> -- /bin/sh
Common Kubernetes Resources
Pods: The smallest deployable units.
Services: Expose applications running on pods.
Deployments: Manage replica sets and rollouts.
ConfigMaps & Secrets: Store configuration and sensitive information.
PersistentVolumes & PersistentVolumeClaims: Manage storage.
Namespaces: Isolate resources within a cluster.
Ingress: Route external traffic into the cluster.
Troubleshooting
kubectl command fails: Ensure kubectl is authenticated and has access to the cluster
Permission denied errors: Verify your role-based access control (RBAC) settings