Kubernetes

,

Description

The k8s Update Module is able to apply Kubernetes manifesto files to the device running Mender.

It supports any Kubernetes distribution, and it requires the kubectl CLI tool both to generate and install the artifact. This Update Module does not implement any rollback mechanism, as it relies on the standard behaviour of the kubectl CLI.

Specification

Module name k8s
Supports rollback no
Requires restart no
Artifact generation script yes
Full system updater no
Source code Update Module, Artifact Generator
Maintainer Community

Prepare the device

This section describes how to setup your target device, i.e. the device to be updated. This will also be referred to as the device environment.

All commands outlined in this section should be run in the device environment.

Prerequisites

This update module has the following prerequisites for the device environment:

How to install these depends on which OS you are running.

Install the Update Module

Download the latest version of this Update Module by running:

mkdir -p /usr/share/mender/modules/v3
wget -P /usr/share/mender/modules/v3 https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/k8s/module/k8s
chmod +x /usr/share/mender/modules/v3/k8s

Prepare the development environment on your workstation

This section describes how to set up your development environment on your workstation.

All commands outlined in this section should be run in the development environment.

Prerequisites

This Update Modules has the following prerequisites for the development environment:

Artifact creation

For convenience, an Artifact generator tool k8s-artifact-gen is provided along the module. This tool will generate Mender Artifacts in the same format that the Update Module expects them.

Download k8s-artifact-gen, by running the following command:

wget https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/k8s/module-artifact-gen/k8s-artifact-gen

Make it executable:

chmod +x k8s-artifact-gen

Now generate a Mender Artifact using the following command:

ARTIFACT_NAME="my-update-1.0"
DEVICE_TYPE="my-device-type"
OUTPUT_PATH=my-my-update-1.0.mender
K8S_MANIFESTOS="deployment.yaml service.yaml"
./k8s-artifact-gen -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -o ${OUTPUT_PATH} $K8S_MANIFESTOS
  • ARTIFACT_NAME - The name of the Mender Artifact
  • DEVICE_TYPE - The compatible device type of this Mender Artifact
  • OUTPUT_PATH - The path where to place the output Mender Artifact. This should always have a .mender suffix
  • K8S_MANIFESTOS - The list of Kubernetes manifestos that we want to apply into the target. Each item should be a valid file, either YAML or JSON.

You can either deploy this Artifact in managed mode with the Mender server (upload it under Releases in the server UI) or by using the Mender client only in Standalone deployments.

Artifact technical details

The Mender Artifact used by this Update Module includes the manifesto fiels as payload files. It uses the kubectl CLI on the target device to apply them.