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

GitHub Action

MicroK8s Action

v0.3.2

MicroK8s Action

play

MicroK8s Action

Run a MicroK8s Kubernetes cluster in your GitHub Action

Installation

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

              

- name: MicroK8s Action

uses: balchua/microk8s-actions@v0.3.2

Learn more about this action in balchua/microk8s-actions

Choose a version

MicroK8s actions

Test Microk8s

MicroK8s is Lightweight and pure upstream K8s. The smallest, simplest, pure production K8s. For clusters, laptops, IoT and Edge, on Intel and ARM.

This installs MicroK8s using Github Actions.

More information about MicroK8s

This Github Action only works on Linux machines.

This Github Actions enables one to test their applications on multiple Kubernetes versions by following MicroK8s channels.

Inputs

channel

Required This is the MicroK8s channel to choose. Example: latest/stable or 1.18/stable or latest/edge/ha-preview

Strict confinement is also available see

addons

New from v0.2.0

Optional a JSON array containing the MicroK8s addon to enable. Example addons: "['prometheus','metrics-server','linkerd']"

rbac

Removed from v0.3.0

Deprecated in favor of the new argument addons

Optional Since MicroK8s does not enable RBAC by default, user can choose whether they want to enable rbac or not.

dns

Removed from v0.3.0

Deprecated in favor of the new argument addons

Optional Since MicroK8s does not enable dns by default, user can choose whether they want to enable CoreDNS or not.

storage

Removed from v0.3.0

Deprecated in favor of the new argument addons

Optional Since MicroK8s does not enable storage by default, user can choose whether they want to enable local hostPath storage or not.

devMode

New from v0.3.0

Example Usage:

Below shows how one can use the Action.

name: Test Microk8s
on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    name: A job to install MicroK8s
    steps:
    - uses: balchua/microk8s-actions@v0.3.0
      with:
        channel: '1.26/stable'
        addons: '["dns", "rbac", "hostpath-storage", "registry", "metrics-server"]'
    - name: Test MicroK8s
      id: myactions
      run: |
        kubectl get no
        kubectl get pods -A -o wide
        

To use microk8s commands for example: microk8s status, you should use sudo or sg command.

    - name: Test MicroK8s commands
      id: microk8s
      run: |
        set -ex
        echo "Executing microk8s status using sg command."
        sg microk8s -c 'microk8s status'
        echo "Executing microk8s status using sudo command."
        sudo microk8s status

sg commands will execute the command using the group specified. Description taken from here

The sg command works similar to newgrp but accepts a command. The command will be executed with the /bin/sh shell. With most shells you may run sg from, you need to enclose multi-word commands in quotes. Another difference between newgrp and sg is that some shells treat newgrp specially, replacing themselves with a new instance of a shell that newgrp creates. This doesn't happen with sg, so upon exit from a sg command you are returned to your previous group ID.

Strict confinement

From v0.3.0 this action now supports Snap strict confinement.

Please note that MicroK8s strict confinement is only available from 1.25 as a separate track 1.25-strict.

More information here

jobs:
  test:
    runs-on: ubuntu-latest
    name: A job to install MicroK8s with strict confinement
    steps:
    - uses: balchua/microk8s-actions@v0.3.0
      with:
        channel: '1.26-strict/stable'
        devMode: 'true'
        addons: '["rbac", "dns", "hostpath-storage", "registry", "metrics-server"]'

Kubeflow Addon

Removed from v0.3.0, since it is no longer part of MicroK8s addon.

You can use the kubeflow microk8s addon to test your ML. Due to the size of the VM used by github actions the KUBEFLOW_BUNDLE used is edge. This is the appropriate bundle for low resource machines.

For more information regarding kubeflow addon check this link

Building

The main program is a Typescript, located in src/index.ts. Before pushing the code to Github, you should compile the source to ES6.

$ npm run build