CI Modules 0.59.2Last updated in version 0.53.0
View Source
Release Notes
Kubernetes CircleCI Helpers
This module contains helper scripts that can setup Kubernetes tools for use in a CircleCI job, including:
setup-minikube
: This script will install and setupminikube
in a way that is compatible with CircleCI. In addition, this script will installkubectl
, setup to talk to theminikube
cluster. Note that this MUST be run on a job that is using the machine executor with the ubuntu 20.04 image (e.g.,ubuntu-2004:202111-02
).
Installing the helpers
You can install the helpers using the Gruntwork Installer:
gruntwork-install --module-name "kubernetes-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "0.0.1"
We recommend running this command in one of the jobs for CircleCI:
job:
setup:
# Note: Since minikube uses Docker, we need to run on the machine executor to avoid complications with
# Docker-in-Docker.
machine:
enabled: true
image: "ubuntu-2004:202111-02"
steps:
- run:
command: |
# Install the Gruntwork Installer
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/main/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version 0.0.22
# Use the Gruntwork Installer to install the kubernetes-circleci-helpers module
gruntwork-install --module-name "kubernetes-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "0.13.12"
Using the setup-minikube helper
The setup-minikube
script will do the following:
- Mark the root directory as rshared so that it is available to
minikube
(see https://github.com/kubernetes/kubernetes/issues/61058 for more info). - Install
kubectl
into/usr/local/bin
. You can use the--k8s-version
flag to customize the version that is installed. Note that the installed Kubernetes version will also reflect this, so that bothkubectl
and the available Kubernetes APIs are in sync. - Install
cri-dockerd
into/usr/bin
. This is required for Kubernetes>= 1.24
. You can use the--cri-dockerd-version
flag to customize the version that is installed. - Install
minikube
into/usr/local/bin
. You can use the--minikube-version
flag to customize the version that is installed. - Start
minikube
and wait for it to come up. You can use the--k8s-version
flag to configure which version of Kubernetes to run. - Disable the
dashboard
addon, while enabling theingress
addon so that it is available, and ensure theingress
addon gets deployed correctly.
A few things to note about the way minikube
is installed:
- Disable VM drivers so that it runs directly.
- RBAC is turned on.
- The nginx ingress controller is turned on with SSL disabled.
- The default
ServiceAccount
in thekube-system
namespace inherits cluster admin status.
You can call this as a step in your job:
job:
setup:
steps:
- run:
command: |
# Install the Gruntwork Installer
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/main/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version 0.0.9
# Use the Gruntwork Installer to install the kubernetes-circleci-helpers module
gruntwork-install --module-name "kubernetes-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "0.0.5"
- run:
command: setup-minikube