CI Modules 0.59.11Last 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 setupminikubein a way that is compatible with CircleCI. In addition, this script will installkubectl, setup to talk to theminikubecluster. 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
kubectlinto/usr/local/bin. You can use the--k8s-versionflag to customize the version that is installed. Note that the installed Kubernetes version will also reflect this, so that bothkubectland the available Kubernetes APIs are in sync. - Install
cri-dockerdinto/usr/bin. This is required for Kubernetes>= 1.24. You can use the--cri-dockerd-versionflag to customize the version that is installed. - Install
minikubeinto/usr/local/bin. You can use the--minikube-versionflag to customize the version that is installed. - Start
minikubeand wait for it to come up. You can use the--k8s-versionflag to configure which version of Kubernetes to run. - Disable the
dashboardaddon, while enabling theingressaddon so that it is available, and ensure theingressaddon 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
ServiceAccountin thekube-systemnamespace 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