Here is how to install configure and use microk8s with skaffold, step by step. Based on the Kubernetes course:
installation:
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && sudo install skaffold /usr/local/bin/
create the initial project skaffold configuration:
skaffold init
create alias to kubectl for skaffold to be able to use it :
sudo snap alias microk8s.kubectl kubectl
provide microk8s config to skaffold:
microk8s.kubectl config view --raw > $HOME/.kube/config
update the pod configuration to use the image from microk8s:
image: localhost:32000/php-app
(add localhost:32000...)
enable microk8s registry addon:
microk8s.enable registry
then test the registry if it works: http://localhost:32000/v2/
skaffold dev --default-repo=localhost:32000
Check if the pod is running:
kubectl get pods
Expose the pod ports to be browsable:
kubectl port-forward pod/skaffold-pod 8080:4000
Optional: In case we need to debug inside the container:
docker run -ti localhost:32000/php-app:latest /bin/bash
Congratulations and enjoy the course !
No comments:
Post a Comment