We will be using kubectl
to create our first Kubernetes app.
We will be using the sample image provided by Google.
kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1
To see our deployment we can do
kubectl get deployments
Now would be a good time to understand what Pods are.
A pod is in essence a group of one/more containers with shared storage and network along with specification on how to run those containers.
Let’s say you have a FastAPI server that can run on its own. This can be run as a Pod with a single container. Kubernetes would then manage the pods instead of working with containers directly.
Pods with multiple containers are often tightly coupled and share resources. They together form a single cohesive unit. This is a fairly advanced usage
kubectl proxy
<aside> 💡
Pods run on a private, isolated network and are not visible from outside the network.
Hence, kubectl
is actually interacting with them over an API
</aside>
This means I can get version information by merely visiting http://localhost:8001/version
or doing
curl <http://localhost:8001/version
>