Kubernetes
Running Kubernetes workloads locally with Podman, Podman Desktop, kubectl and minikube.
3 min read
| Docker | Kubernetes |
|---|---|
| docker | podman |
| docker-desktop | podman-desktop |
| docker compose, docker swarm | podman compose, kubernetes yaml |
podman
Tool for managing OCI containers and pods
# install podmanbrew install podman# create the virtual machine for podmanpodman machine init# start the virtual machine and set up the connection to podmanpodman machine start# stop the virtual machinepodman machine stop# connect the vm podman-machine-defaultpodman machine ssh# remove the virtual machinepodman machine rmTo create and start the virtual machine that is needed for podman:
podman machine init --cpus 2 --memory 2048 --disk-size 20podman machine startpodman system connection default podman-machine-default-rootpodman infoUseful podman commands:
# searches a registry or a list of registries for a matching imagepodman search busybox# Run a process in a new containerpodman run -it docker.io/library/busybox# Builds an image using instructions from one or more Containerfiles or Dockerfiles and a specified build context directorypodman build -t nginx https://git.io/Jf8ol# Run a process in a new containerpodman run -d -p 8080:80 nginx# log in to quaypodman login quay.io# tag the imagepodman tag localhost/nginx quay.io/USERNAME/nginx# push the imagepodman push quay.io/USERNAME/nginx# display the low-level information on containers and imagespodman inspect quay.io/USERNAME/nginx# list the running containerspodman pspodman-desktop
Browse, manage, inspect containers and images
brew install podman-desktopkubernetes yaml
It is recommended to use Kubernetes YAML instead of Compose.
You provide the information to kubectl in a deployment.yaml file. kubectl converts the information to JSON when making the API request. Below is an example .yaml file to for describing a Kubernetes object.

To create a Deployment using a .yaml file:
kubectl apply -f [path-or-url-of-the-deployment file]kubectl
Kubernetes command-line interface
# install kubectlbrew install kubectl# orbrew install kubernetes-cli# Test to ensure the version you installed is up-to-datekubectl version --client# Check that kubectl is properly configured by getting the cluster statekubectl cluster-infoIf you see a message similar to the following, kubectl is not configured correctly or is not able to connect to a Kubernetes cluster.
The connection to the server <server-name:port> was refused - did you specify the right host or port?For example, if you are intending to run a Kubernetes cluster on your laptop (locally), you will need a tool like Minikube to be installed first and then re-run the commands stated above.
If kubectl cluster-info returns the url response but you can’t access your cluster, to check whether it is configured properly, use:
kubectl cluster-info dumpminikube
minikube is local Kubernetes, focusing on making it easy to learn and develop for Kubernetes.
# install minikubebrew install minikube# start your clusterminikube start# start minikube with the qemu driverminikube start --driver=qemu# start minikube with the podman driver onlyminikube start --driver=podman# make podman the default driverminikube config set driver podmanBy default, minikube executes Podman with sudo. To use Podman without sudo (i.e., Rootless Podman), set the rootless property to true:
minikube config set rootless trueFor Rootless Podman, it is recommended to set --container-runtime to containerd:
minikube start --driver=podman --container-runtime=containerd