Kubernetes

To use Airlock Microgateway in your Kubernetes cluster, follow this guide to deploy the Airlock Microgateway Operator and its resources.

Prerequisites

  • To use Airlock Microgateway, a valid license is required. Airlock Microgateway is available in a Premium and a free Community edition. To request and configure/change a license, see the article Licensing and license-dependent behavior.
  • Deploy the cert-manager in your Kubernetes cluster.

For an easy start in non-production environments, you may deploy the same cert-manager we use for internal testing. Note that the files provided are not intended for production use! Consult the manual for productive environments (Kubernetes) Install cert-manager.

copy
# Deploy the cert-manager
kubectl apply -k "https://github.com/airlock/microgateway/examples/utilities/cert-manager/?ref=4.2.1"

# Wait for the cert-manager to be up and running
kubectl -n cert-manager wait --for=condition=ready --timeout=600s pod -l app.kubernetes.io/instance=cert-manager

Airlock Microgateway CNI installation

Install the CNI DaemonSet and required RBAC (Role Based Access Control) manifests with helm.

  1. Adapt and run the following command with the current CNI Helm chart version.
  2. copy
    helm install airlock-microgateway-cni -n kube-system oci://quay.io/airlockcharts/microgateway-cni --version 4.2.1
  3. Wait for the Airlock Microgateway CNI DaemonSet to be up and running.
  4. copy
    kubectl -n kube-system rollout status daemonset -l app.kubernetes.io/instance=airlock-microgateway-cni
  5. Verify the correctness of the installation with helm test.
  6. copy
    helm upgrade airlock-microgateway-cni -n kube-system oci://quay.io/airlockcharts/microgateway-cni --set tests.enabled=true --reuse-values --version 4.2.1
  7. Check the log messages.
  8. copy
    helm test airlock-microgateway-cni -n kube-system --logs
  9. On successful installation, the logs should show the following message: Success
  10. Disable the helm test deployment afterward.
  11. copy
    helm upgrade airlock-microgateway-cni -n kube-system  oci://quay.io/airlockcharts/microgateway-cni --set tests.enabled=false --reuse-values --version 4.2.1

Environment preset values

Different environment preset values (e.g., gke-values.yaml and openshift-values.yaml) are available on GitHub. These values have been tested in our installation environments. The default presets may need to be adapted to meet the requirements of your setup.

The values can be applied during installation using -f <values-name>.yaml directly from GitHub or a local source.
For installation in OpenShift environments, see article OpenShift.

Airlock Microgateway CRDs deployment

CRDs are cluster-wide resources and thus have to be deployed separately from the Helm chart-driven Airlock Microgateway Operator deployment.

  1. Deploy the CRDs.
  2. copy
    kubectl apply -k "https://github.com/airlock/microgateway/deploy/crds/?ref=4.2.1"

Install the Airlock Microgateway Operator

In order to complete the Airlock Microgateway Operator installation and to run the below help test successfully, you need to deploy a valid license. See article Licensing and license-dependent behavior for more information.

  1. Create the airlock-microgateway-system namespace
  2. copy
    kubectl create namespace airlock-microgateway-system
  3. Store the license in the Microgateway Operator namespace, in a Kubernetes secret with the name airlock-microgateway-license and the key microgateway-license.txt. Use the following command:
  4. copy
    kubectl -n airlock-microgateway-system create secret generic airlock-microgateway-license  
    --from-file=microgateway-license.txt=<my-local-microgateway-license.txt>
  5. Adapt and run the following command with the current Airlock Microgateway Operator Helm chart version. This will install airlock-microgateway in the airlock-microgateway-system namespace.
  6. copy
    helm install -n airlock-microgateway-system airlock-microgateway oci://quay.io/airlockcharts/microgateway --wait --version 4.2.1
  7. Verify that the Airlock Microgateway Operator started successfully:
  8. copy
    kubectl -n airlock-microgateway-system wait --for=condition=Available deployments --all --timeout=3m
  9. Verify the correctness of the installation with helm test.
  10. copy
    helm upgrade airlock-microgateway -n airlock-microgateway-system oci://quay.io/airlockcharts/microgateway --set tests.enabled=true --reuse-values --version 4.2.1
  11. Check the log messages.
  12. copy
    helm test airlock-microgateway -n airlock-microgateway-system --logs

    During installation, the installation status is echoed – i.e., the preliminary cleanup task and scaling the test installation to only 1 replica (to ensure no pods from previous runs are present).

  13. On successful installation, the logs should show the following message: ### Installation of 'airlock-microgateway' succeeded
  14. Disable the helm test deployment afterward.
  15. copy
    helm upgrade airlock-microgateway -n airlock-microgateway-system oci://quay.io/airlockcharts/microgateway --set tests.enabled=false --reuse-values --version 4.2.1

ClusterRoles to interact with Airlock Microgateway CustomResources

The Kubernetes manifest file contains two ClusterRoles for each CRD. One with viewer and one with editor rights.
They follow the naming schema as described below:

airlock-microgateway-operator-<CRD name>-editor 
airlock-microgateway-operator-<CRD name>-viewer

As example for the CRD SidecarGateway:

airlock-microgateway-operator-sidecargateway-editor 
airlock-microgateway-operator-sidecargateway-viewer

Users who must be able to create and view Airlock Microgateway CRs need the required -editor ClusterRoles assigned to their user. Users who only need to view (read-only rights) Airlock Microgateway CRs need the required -viewer ClusterRoles assigned to their user.

Because each CRD has its ClusterRoles, administrators can define fine-grained access control.

Note: The RBAC rules are not installed by default. To do so execute the following command:

copy
kubectl apply -k "https://github.com/airlock/microgateway/deploy/crd-rbac/?ref=4.2.1"