Configuring IPsec encryption for single-node OpenShift clusters using GitOps ZTP and ClusterInstance resources
You can enable IPsec encryption in managed single-node OpenShift clusters that you install using GitOps ZTP and Red Hat Advanced Cluster Management (RHACM). You can encrypt traffic between the managed cluster and IPsec endpoints external to the managed cluster. All network traffic between nodes on the OVN-Kubernetes cluster network is encrypted with IPsec in Transport mode.
|
|
You can also configure IPsec encryption for single-node OpenShift clusters with an additional worker node by following this procedure. It is recommended to use the |
-
You have installed the OpenShift CLI (
oc). -
You have logged in to the hub cluster as a user with
cluster-adminprivileges. -
You have installed the SiteConfig Operator in the hub cluster.
-
You have configured RHACM and the hub cluster for generating the required installation and policy custom resources (CRs) for managed clusters.
-
You have created a Git repository where you manage your custom site configuration data. The repository must be accessible from the hub cluster and be defined as a source repository for the Argo CD application.
-
You have installed the
butaneutility version 0.20.0 or later. -
You have a PKCS#12 certificate for the IPsec endpoint and a CA cert in PEM format.
-
Extract the latest version of the
ztp-site-generatecontainer source and merge it with your repository where you manage your custom site configuration data. -
Configure
optional-extra-manifest/ipsec/ipsec-endpoint-config.yamlwith the required values that configure IPsec in the cluster. For example:interfaces: - name: hosta_conn type: ipsec libreswan: left: '%defaultroute' leftid: '%fromcert' leftmodecfgclient: false leftcert: left_server leftrsasigkey: '%cert' right: <external_host> rightid: '%fromcert' rightrsasigkey: '%cert' rightsubnet: <external_address> ikev2: insist type: tunnel-
leftcertmust match the name of the certificate used on the remote system. -
rightis the external host IP address or DNS hostname. -
rightsubnetis the IP subnet of the external host on the other side of the IPsec tunnel. -
ikev2: insistuses the IKEv2 VPN encryption protocol only. Do not use IKEv1, which is deprecated.
-
-
Add the following certificates to the
optional-extra-manifest/ipsecfolder:-
left_server.p12: The certificate bundle for the IPsec endpoints -
ca.pem: The certificate authority that you signed your certificates withThe certificate files are required for the Network Security Services (NSS) database on each host. These files are imported as part of the Butane configuration in later steps.
-
-
Open a shell prompt at the
optional-extra-manifest/ipsecfolder of the Git repository where you maintain your custom site configuration data. -
Run the
optional-extra-manifest/ipsec/build.shscript to generate the required Butane andMachineConfigCRs files.If the PKCS#12 certificate is protected with a password, set the
-Wargument.The following example shows the generated output directory structure:
out └── argocd └── example └── optional-extra-manifest └── ipsec ├── 99-ipsec-master-endpoint-config.bu ├── 99-ipsec-master-endpoint-config.yaml ├── 99-ipsec-worker-endpoint-config.bu ├── 99-ipsec-worker-endpoint-config.yaml ├── build.sh ├── ca.pem ├── left_server.p12 ├── enable-ipsec.yaml ├── ipsec-endpoint-config.yml └── README.md-
The
ipsec/build.shscript generates the Butane and endpoint configuration CRs. -
Add the
ca.pemandleft_server.p12certificate files that are relevant to your network.
-
-
Create an
ipsec-manifests/folder in the repository where you manage your custom site configuration data. Add theenable-ipsec.yamland99-ipsec-*YAML files to the directory. For example:site-configs/ ├── hub-1/ │ └── clusterinstance-site1-sno-du.yaml ├── ipsec-manifests/ │ ├── enable-ipsec.yaml │ ├── 99-ipsec-worker-endpoint-config.yaml │ └── 99-ipsec-master-endpoint-config.yaml └── kustomization.yaml -
Create a
kustomization.yamlfile that usesconfigMapGeneratorto package your IPsec manifests into aConfigMap:apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - hub-1/clusterinstance-site1-sno-du.yaml configMapGenerator: - name: ipsec-manifests-cm namespace: site1-sno-du files: - ipsec-manifests/enable-ipsec.yaml - ipsec-manifests/99-ipsec-master-endpoint-config.yaml - ipsec-manifests/99-ipsec-worker-endpoint-config.yaml generatorOptions: disableNameSuffixHash: true-
namespacemust match theClusterInstancenamespace. -
disableNameSuffixHash: truedisables the hash suffix so theConfigMapname is predictable.
-
-
In your
ClusterInstanceCR, reference theConfigMapin theextraManifestsRefsfield:apiVersion: siteconfig.open-cluster-management.io/v1alpha1 kind: ClusterInstance metadata: name: "site1-sno-du" namespace: "site1-sno-du" spec: clusterName: "site1-sno-du" networkType: "OVNKubernetes" extraManifestsRefs: - name: ipsec-manifests-cm # ...-
extraManifestsRefs.namereferences theConfigMapcontaining the IPsec manifests.
If you have other extra manifests, you can either include them in the same
ConfigMapor create multipleConfigMapresources and reference each of those in theextraManifestsRefsfield. -
-
Commit the
ClusterInstanceCR, IPsec manifest files, andkustomization.yamlchanges in your Git repository and push the changes to provision the managed cluster and configure IPsec encryption.The Argo CD pipeline detects the changes and begins the managed cluster deployment.
During cluster provisioning, the SiteConfig Operator applies the CRs contained in the referenced
ConfigMapresources as extra manifests.
For information about verifying the IPsec encryption, see "Verifying the IPsec encryption".