Its piling up… the choices do to test k8s on my mac:
- minikube (never liked it in the past)
- kubernetes from Docker Desktop
- microk8s
- kind
- OpenShift Local (crc)
Here are some notes about how to install, pros + cons.
minikube
needs Docker Desktop, minikube container will show up. Can handle PV/PVC. (helm example: https://phoenixnap.com/kb/postgresql-kubernetes)
brew install minikube
minikube start # kubernetes v1.26.1
# cd Software/Helm/Postgres
helm install psql-test bitnami/postgresql –set persistence.existingClaim=postgresql-pv-claim –set volumePermissions.enabled=true
…
kubectl port-forward –namespace default svc/psql-test-postgresql 5432:5432 &
PGPASSWORD=“$POSTGRES_PASSWORD“ psql –host 127.0.0.1 -U postgres -d postgres -p 5432
…
chrisp:Postgres sandorm$ export POSTGRES_PASSWORD=$(kubectl get secret –namespace default psql-test-postgresql -o jsonpath=“{.data.postgres-password}“ | base64 -d)
minikube stop
Problems on my 8GB airbook, not starting up properly.
kind
kind or kubernetes in docker is a suite of tooling for local Kubernetes “clusters” where each “node” is a Docker container (kind-*) So, it needs Docker Desktop.
# start Docker Desktop
brew install kind
# create multinode cluster – downloads more
kind create cluster –config ./kind-sample.config
✓ Ensuring node image (kindest/node:v1.20.2) 🖼
…
kind get clusters
kubectl cluster-info –context kind-kind
k get nodes # must be ‚ready‘
# stop kind cluster:
docker ps -a
docker pause
# logs
kind export logs ./mylogs
Problems: node not ready. PVC: see https://stackoverflow.com/questions/62694361/how-to-reference-a-local-volume-in-kind-kubernetes-in-docker
k describe nodes | grep 'not ready' Ready False Tue, 07 Mar 2023 14:11:34 +0100 Tue, 07 Mar 2023 14:11:17 +0100 KubeletNotReady runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized
No problems on a fresh install on my airbook:
kind create cluster –name kind-playground –config ./multinode.yaml
Creating cluster „kind-playground“ …
⠎⠁ Ensuring node image (kindest/node:v1.25.3) 🖼
⠈⠁ Ensuring node image (kindest/node:v1.25.3) 🖼
⠈⠁ Ensuring node image (kindest/node:v1.25.3) 🖼 ^C
luftichris:Kind christianhofig$ kind create cluster –name kind-playground –config ./multinode.yaml
Creating cluster „kind-playground“ …
✓ Ensuring node image (kindest/node:v1.25.3) 🖼
✓ Preparing nodes 📦 📦 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
✓ Joining worker nodes 🚜
Set kubectl context to „kind-kind-playground“
You can now use your cluster with:
kubectl cluster-info –context kind-kind-playground
k cluster-info –context kind-kind-playground
Kubernetes control plane is running at https://127.0.0.1:55156
CoreDNS is running at https://127.0.0.1:55156/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use ‚kubectl cluster-info dump‘.
luftichris:Kind christianhofig$ k get nodes
NAME STATUS ROLES AGE VERSION
kind-playground-control-plane Ready control-plane 86m v1.25.3
kind-playground-worker Ready
kind-playground-worker2 Ready
luftichris:kubernetes_patterns christianhofig$docker exec -it 4ba648f10d3e /bin/sh
# ps auxw
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.2 18756 9280 ? Ss 09:14 0:02 /sbin/init
root 89 0.0 0.1 23152 6852 ? S<s 09:14 0:01 /lib/systemd/systemd-journald
root 102 1.7 0.9 1866320 38280 ? Ssl 09:15 3:22 /usr/local/bin/containerd
root 209 3.8 1.3 1882200 55400 ? Ssl 09:17 7:30 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/e
root 289 0.0 0.2 712228 8960 ? Sl 09:17 0:10 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id d4400a7f094891eb47c97f03ad1e25337
65535 309 0.0 0.0 996 4 ? Ss 09:17 0:00 /pause
root 321 0.0 0.1 712484 7440 ? Sl 09:17 0:09 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id 5c59abc08ed822feec1970a1a41b017fe
65535 350 0.0 0.0 996 4 ? Ss 09:17 0:00 /pause
root 399 0.1 0.5 753708 20700 ? Ssl 09:17 0:12 /usr/local/bin/kube-proxy --config=/var/lib/kube-proxy/config.conf --hostname-override=kind-pl
root 2177 0.0 0.2 712228 9280 ? Sl 11:25 0:02 /usr/local/bin/containerd-shim-runc-v2 -namespace k8s.io -id 8aa102c08b58c4633b51230426b6e8b65
65535 2198 0.0 0.0 996 4 ? Ss 11:25 0:00 /pause
root 2441 0.0 0.4 722376 17716 ? Ssl 11:42 0:01 registry serve /etc/docker/registry/config.yml
root 3021 0.1 0.5 731752 22704 ? Ssl 12:16 0:01 /bin/kindnetd
root 3325 1.5 0.0 2888 928 pts/2 Ss 12:32 0:00 /bin/sh
root 3333 0.0 0.0 7060 1564 pts/2 R+ 12:32 0:00 ps auxwCode-Sprache: HTML, XML (xml)
kubernetes in Docker
Enable kubernetes in Docker Desktop options.
k config set-context docker-desktop
k config view
…
– cluster:
certificate-authority-data: DATA+OMITTED
server: https://kubernetes.docker.internal:6443
name: docker-desktop
…
– context:
cluster: docker-desktop
user: docker-desktop
name: docker-desktop
…
users:
– name: docker-desktop
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
..
# copy this setting to ~/.kube/docker-desktop
export KUBECONFIG=~/.kube/docker-desktop