Kubernetes Basics
Names and UID
Every object in a kubernetes cluster has a Name that is unique for that type of resource.
Every object also has a UID that is unique across the whole cluster.
A name can be part of a url, such as /api/v1/pods/some-name.
minikube profiles
minikube works with profiles, allowing you to work with multiple versions of Kubernetes.
Each cluster can have a different profile
$ minikube profile default
This sets the current minikube profile name to “default”
Namespace
A Namespace refers to a grouping of Kubernetes resources.
Namespaces cannot be nested inside one another.
Each kubernetes resource can only belong to one namespace.
Not all kubernetes resources belong to a namespace. Some low-level resources, such as nodes and persistentVolumes are not in any namespace.
kubeconfig
The kubeconfig uses a Context which contains:
cluster information,
authentication info such as username/passwords, certificates and tokens.
contexts
Pods
A Pod is the smallest possible deployable component in Kubernetes consisting of one or more co-located containers.
It is common for pods to contain only a single container.
Containers are designed to run only a single process per container. This way, the logs also remain separate. However, in certain cases, we may also want containers to share certain resources. Kubernetes achieves this by configuring Docker to have all containers of a pod share the same set of Linux namespaces instead of each container having its own set.
They share the same hostname and network interfaces and can communicate through the same IPC namespace if required.
However, for the filesystem, as they are built from docker images, they are fully isolated from other containers even on the same pod.
Pod Lifecycle
The diagram above shows the status of a pod and how it can move from one state to another during its life cycle.
Pod Conditions
Depending on the status of a pod, the pod can have various statuses as given below:
PodScheduled
Initialized
ContainersReady: The containers in the pod are ready to accept traffic.
Ready