2024/2025
kubectl api-resources -o name - ANSWERScommand will list the object types currently available on the
cluster
kubectl describe $object_type $object_name - ANSWERSget information about an object's spec and
status
kubectl get pods - ANSWERSGets pods currently running (in the default namespace)
kubectl get nodes - ANSWERSgets all nodes currently running in cluster
kubectl get node $node_name - ANSWERSGets name, status, version, etc. about node that is specified
kubectl get node $node_name -o yaml - ANSWERSGets very detailed information about the node that is
specified in yaml information defining the object and it's spec
Pods - ANSWERSThe basic building blocks of any application running in kubernetes
Pod - ANSWERSConsists of one or more containers and a set of resources shared by those containers. All
containers managed by a Kubernetes cluster are part of a POD
kubecutl create -f mypod.yml - ANSWERScreate a pod from the yaml definition file
kubectl apply -f my-pod.yml - ANSWERSEdit a pod by updating the yaml definition and reapplying it
kubectl edit pod my-pod - ANSWERSEdit a pod
, kubectl delete pod my-pod - ANSWERSDelete a pd
kubectl get namespaces - ANSWERSYou can get a list of the namespaces in the cluster
kubectl create ns namespace_name - ANSWERScommand to create a namespace
namespaces - ANSWERSvirtual cluster that makes it easier to manage environments with man users
across multiple teams or projects
command: ['echo'] - ANSWERSUnder the spec for your container you can specify a command this way.
args: [" array", "of", "arguments"] - ANSWERSThe command option in specs also takes an array of
arguments (as strings).
- containerPort: 80 - ANSWERSYour container may want to network with other containers. This will
require you to specify a port for the container (port 80 in this example).
config maps - ANSWERSa k8s object that stores confguration data in a key-value format. This config data
can then be used to configure software running in a container, by referencing the configMap in the pod
spec.
kubectl logs pod_name - ANSWERSDumps pod logs to STDOUT
kubectl exec my-pod -- ls / - ANSWERSExecutes a command inside a pod, in this case "ls /"
resource request - ANSWERSthe amount of resources necessary to run a container
resource limit - ANSWERSA max value for the resource usage of a container
service accounts - ANSWERSallow containers running in pods to access the K8s API. Some apps may need
to interact with the cluser itself. This provides a way to let