Setup minikube as CI step in GitHub Actions
How to use minikube in GitHub Actions for testing your app
To install and start a minikube cluster, add the following step to your GitHub Actions workflow.
for more information see GitHub Actions marketplace setup-minikube.
Example: build image & deploy to minikube on each PR
Requirements:
- a valid Dockerfile
- a valid
deployment.yaml
file withimagePullPolicy: Never
see below for an example
Create workflow:
-
copy this yaml to your workflow file for example in
.github/workflows/pr.yml
:
The above example workflow yaml, will do the following steps on each coming PR:
- Checks out the the source code
- Installs & starts minikube
- Tries out the cluster just by running
kubectl
command - Build the docker image using minikube’s docker-env feature
- Apply the deployment yaml file minikube
- Check the service been created in minikube
Example minikube deployment yaml with a service
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.