Air gap installation
For an air-gapped installation of Kubewarden, you need a private Open Container Initiative (OCI) registry accessible by your Kubernetes cluster. Kubewarden Policies are WebAssembly modules, therefore you can store them in an OCI-compliant registry as OCI artifacts. You need to add Kubewarden’s images and policies to this OCI registry. You can refer to a list of Kubewarden artifacts in the Artifacts reference page. The following sections describe the process.
|
We recommend using Hauler. See our Hauler documentation page. Alternatively, you can use the manual process listed below. |
Save Helm charts locally
You need to download the following helm charts to your workstation:
helm pull kubewarden/kubewarden-crds
helm pull kubewarden/kubewarden-controller
helm pull kubewarden/kubewarden-defaults
helm pull kubewarden/sbomscanner
|
Optionally, you can verify the signatures of the helm charts and container images. |
Save container images locally
-
Each of our Helm charts contains an
imagelist.txtwith the container images consumed by it, and, when applicable, apolicylist.txtwith the OCI Wasm modules of the policies that it consumes too.To obtain them, you can do:
helm pull --untar \ kubewarden/kubewarden-crds \ kubewarden/kubewarden-controller \ kubewarden/kubewarden-defaults \ kubewarden/sbomscannerAnd then concatenate them into one file:
cat */imagelist.txt > kubewarden-images.txt -
Download
kubewarden-save-images.shandkubewarden-load-images.shfrom the utilities repository. -
Save Kubewarden container images into a
.tar.gzfile:./kubewarden-save-images.sh \ --image-list ./kubewarden-images.txt \ --images kubewarden-images.tar.gzDocker begins pulling the images used for an air gap install. This process can take a few minutes. When complete, your current directory, where you ran the command, has a tarball,
kubewarden-images.tar.gz.
Save policies locally
-
Add all the policies you want to use to a
policies.txtfile:cat */policylist.txt > policies.txtA file with a list of default policies is in the Kubewarden defaults release page.
-
Download
kubewarden-save-policies.shandkubewarden-load-policies.shfrom thekubewarden-controllerrepository. -
Save policies into a
.tar.gzfile:./kubewarden-save-policies.sh --policies-list policies.txtUse
kwctlto download the policies. Thekubewarden-policies.tar.gzarchive contains the policies.
Helm charts
You need to download the following helm charts to your workstation:
helm pull kubewarden/kubewarden-crds
helm pull kubewarden/kubewarden-controller
helm pull kubewarden/kubewarden-defaults
Populate private registry
Move these files to the air gap environment:
-
Helm charts in
tgzformat (for example,kubewarden-crds-1.23.0.tgz) -
kubewarden-policies.tar.gz, -
kubewarden-images.tar.gz, -
kubewarden-load-images.sh, -
kubewarden-load-policies.shand -
policies.txt-
Load Kubewarden images into the private registry. You need to authenticate the Docker client against the local registry .
./kubewarden-load-images.sh \ --image-list ./kubewarden-images.txt \ --images kubewarden-images.tar.gz \ --registry <REGISTRY.YOURDOMAIN.COM:PORT> -
Load Kubewarden policies into the private registry. You should authenticate
kwctlthe local registry (kwctluses the same mechanism to authenticate asdocker, a~/.docker/config.jsonfile)./kubewarden-load-policies.sh \ --policies-list policies.txt \ --policies kubewarden-policies.tar.gz \ --registry <REGISTRY.YOURDOMAIN.COM:PORT> \ --sources-path sources.yml
-
|
The
Refer to the section on
custom certificate authorities in the documentation to learn about configuring
the |
Install Kubewarden
Now that your private registry has everything required you can install Kubewarden. The only difference to a standard Kubewarden installation is that you need to change the registry in the container images and policies to be the private registry.
Install the Kubewarden stack:
helm install --wait -n kubewarden \
kubewarden-crds kubewarden-crds.tgz
helm install --wait -n kubewarden \
kubewarden-controller kubewarden-controller.tgz \
--set global.cattle.systemDefaultRegistry=<REGISTRY.YOURDOMAIN.COM:PORT>
|
To use the Policy Reporter subchart available in the
It’s necessary to define |
helm install --wait -n kubewarden \
kubewarden-defaults kubewarden-defaults.tgz \
--set global.cattle.systemDefaultRegistry=<REGISTRY.YOURDOMAIN.COM:PORT>
|
To download the recommended policies installed by the To install, and wait for the installation to complete, use the following command:
If the |
Finally, you need to configure Policy Server to fetch policies from your private registry. Refer to the using private registry section of the documentation.
Now you can create Kubewarden policies in your cluster. Policies must be available in your private registry.
kubectl apply -f - <<EOF
apiVersion: policies.kubewarden.io/v1
kind: ClusterAdmissionPolicy
metadata:
name: privileged-pods
spec:
module: registry://<REGISTRY.YOURDOMAIN.COM:PORT>/kubewarden/policies/pod-privileged:v0.2.2
rules:
- apiGroups: [""]
apiVersions: [“v1”]
resources: [“pods”]
operations:
- CREATE
mutating: false
EOF
|
|