Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
box

GitHub Action

setup-minikube

v0.0.8

setup-minikube

box

setup-minikube

test your app against real Kubernetes

Installation

Copy and paste the following snippet into your .yml file.

              

- name: setup-minikube

uses: medyagh/[email protected]

Learn more about this action in medyagh/setup-minikube

Choose a version

About setup-minikube

  • build/deploy/test your application against a real Kubernetes cluster in GitHub Actions.
  • maintained by minikube maintainers.

Basic Usage

    steps:
    - name: start minikube
      id: minikube
      uses: medyagh/setup-minikube@latest

Examples

Configurable Fields

minikube-version (optional)
    - default: latest
    - options:
      - version in format of 'X.X.X'
      - 'latest' for the latest stable release
      - 'HEAD' for the latest development build
    - example: 1.24.0
  
driver (optional)
    - default: '' (minikube will auto-select)
    - options:
      - docker
      - none (baremetal)
      - virtualbox (available on macOS free agents)
      - also possible if installed on self-hosted agent: podman, parallels, vmwarefusion, hyperkit, vmware, ssh
  
container-runtime (optional)
    - default: docker
    - options:
      - docker
      - containerd
      - cri-o
  
kubernetes-version (optional)
    - default: stable
    - options:
      - 'stable' for the latest stable Kubernetes version
      - 'latest' for the Newest Kubernetes version
      - 'vX.X.X'
    - example: v1.23.1
  
cpus (optional)
    - default: '' (minikube will auto-set)
    - options:
      - ''
      - 'max' to use the maximum available CPUs
    - example: 4
  
memory (optional)
    - default: '' (minikube will auto-set)
    - options:
      - '' where unit = b, k, m or g
      - 'max' to use the maximum available memory
    - example: 4000m
  
cni (optional)
    - default: auto
    - options:
      - bridge
      - calico
      - cilium
      - flannel
      - kindnet
      - (path to a CNI manifest)
  

Example 1:

Start Kubernetes on pull request

name: CI
on:
  - pull_request
jobs:
  job1:
    runs-on: ubuntu-latest
    name: job1
    steps:
    - name: start minikube
      id: minikube
      uses: medyagh/setup-minikube@master
    # now you can run kubectl to see the pods in the cluster
    - name: kubectl
      run: kubectl get pods -A

Example 2

Start Kubernetes using all configuration options

name: CI
on:
  - pull_request
jobs:
  job1:
    runs-on: ubuntu-latest
    name: job1
    steps:
    - name: start minikube
      id: minikube
      with:
        minikube-version: 1.24.0
        driver: docker
        container-runtime: containerd
        kubernetes-version: v1.22.3
        cpus: 4
        memory: 4000m
        cni: bridge
      uses: medyagh/setup-minikube@master
    # now you can run kubectl to see the pods in the cluster
    - name: kubectl
      run: kubectl get pods -A

Example 3:

Build image and deploy to Kubernetes on pull request

name: CI
on:
  - push
  - pull_request
jobs:
  job1:
    runs-on: ubuntu-latest
    name: build discover and deploy
    steps:
    - uses: actions/checkout@v2
    - name: Start minikube
      uses: medyagh/setup-minikube@master
      # now you can run kubectl to see the pods in the cluster
    - name: Try the cluster!
      run: kubectl get pods -A
    - name: Build image
      run: |
        export SHELL=/bin/bash
        eval $(minikube -p minikube docker-env)
        make build-image
        echo -n "verifying images:"
        docker images
    - name: Deploy to minikube
      run:
        kubectl apply -f deploy/deploy-minikube.yaml
    - name: Test service URLs
      run: |
        minikube service list
        minikube service discover --url
        echo -n "------------------opening the service------------------"
        curl $(minikube service discover --url)/version

Real World:

Add your own repo here:

About Author

Medya Ghazizadeh, Follow me on twitter for my dev news!