You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note**: If you choose not to install the kubelet-csr-approver, you must omit the flags related to the CIS benchmarks mentioned above from your configuration.
24
+
**Note**: If you choose not to install the kubelet-csr-approver, you must omit the flags related to the CIS benchmarks mentioned above from your configuration from the `cis-mitigations-cp-patch.yaml` file.
25
25
26
-
## Prerequisites
26
+
## Directory Structure
27
27
28
-
Before applying the kustomization, you need to determine the available Nutanix-provided KubeadmControlPlaneTemplates (those with the "nkp-" prefix) and their versions:
28
+
This directory contains the following files:
29
29
30
-
```bash
31
-
# List all available KubeadmControlPlaneTemplates
32
-
kubectl get kubeadmcontrolplanetemplates.controlplane.cluster.x-k8s.io
33
-
34
-
# Example output:
35
-
# NAME AGE
36
-
# nkp-nutanix-v2.14.0 4d
37
-
# some-other-template 19h
38
-
```
39
-
40
-
**Important**: You must use the Nutanix-provided template (starting with "nkp-") for these hardening configurations to work correctly.
41
-
42
-
Then export the original Nutanix KubeadmControlPlaneTemplate using the appropriate version:
43
-
44
-
```bash
45
-
# Replace <VERSION> with your actual version (e.g., v2.14.0)
46
-
kubectl get kubeadmcontrolplanetemplates.controlplane.cluster.x-k8s.io nkp-nutanix-<VERSION> -o yaml > nkp-nutanix-<VERSION>.yaml
47
-
```
48
-
49
-
## Structure
50
-
51
-
-`nkp-nutanix-<VERSION>.yaml` - The original KubeadmControlPlaneTemplate (generated by user, replace <VERSION> with your actual version)
30
+
-`harden.sh` - Automated script to simplify the hardening process (recommended method)
-`kustomization.yaml` - Kustomization file that applies the patch and renames the template
33
+
-`nkp-nutanix-<VERSION>.yaml` - The original KubeadmControlPlaneTemplate (generated during the hardening process via `./harden.sh`)
54
34
55
-
**Note**: You need to edit BOTH of these files with your actual version:
56
-
57
-
1. Edit the `cis-mitigations-cp-patch.yaml` file to replace `<VERSION>` with your actual version in the `metadata.name` field:
58
-
59
-
```yaml
60
-
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
61
-
kind: KubeadmControlPlaneTemplate
62
-
metadata:
63
-
name: nkp-nutanix-<VERSION> # <-- Replace <VERSION> with your actual version
64
-
```
65
-
66
-
2. Edit the `kustomization.yaml` file to replace `<VERSION>` in the resources section:
67
-
68
-
```yaml
69
-
resources:
70
-
- nkp-nutanix-<VERSION>.yaml # <-- Replace <VERSION> with your actual version
71
-
```
35
+
The `harden.sh` script automates the following tasks:
36
+
1. Lists available KubeadmControlPlaneTemplates
37
+
2. Prompts for the NKP version
38
+
3. Exports the original template
39
+
4. Updates all version placeholders in configuration files
40
+
5. Applies the kustomization to create the hardened template
41
+
6. Provides guidance on patching the ClusterClass to use the hardened template
72
42
73
-
## Applying the Kustomization
43
+
## Applying the Hardening
74
44
75
-
You can apply this kustomization directly with kubectl:
45
+
Simply run the hardening script and follow the prompts. Ensure that you have the `KUBECONFIG` environment variable set to the Management Cluster (or Self-Managed) before running it:
76
46
77
47
```bash
78
-
#Ensure you are in a directory for the kustomization.yaml, cis-mitigations-cp-patch.yaml and the nkp-nutanix-<VERSION>.yaml file
Copy file name to clipboardExpand all lines: examples/capi-quick-start/nutanix-cluster-hardened-clusterclass/control-plane/cis-mitigations-cp-patch.yaml
+2-39Lines changed: 2 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -47,38 +47,7 @@ spec:
47
47
extraArgs:
48
48
#1.4.1 Ensure that the --profiling argument is set to false
49
49
profiling: "false"
50
-
files:
51
-
#1.2.9 Ensure that the admission control plugin EventRateLimit is set
0 commit comments