From 50437c06b94d014c2184fbaa3e24589134fc9a4d Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Mon, 2 Mar 2026 08:56:36 +0000 Subject: [PATCH 1/9] add flags to support run as static pod --- cmd/main.go | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 34652e9..c6699da 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -27,6 +27,7 @@ import ( "go.uber.org/zap/zapcore" _ "k8s.io/client-go/plugin/pkg/client/auth" "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -65,6 +66,8 @@ func main() { var enableWebhook bool var metricsSecure bool var metricsCertDir string + var kubeconfig string + var leaderElectionNamespace string flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+ "Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.") flag.BoolVar(&metricsSecure, "metrics-secure", false, @@ -78,6 +81,8 @@ func main() { "Enabling this will ensure there is only one active controller manager.") flag.BoolVar(&enableWebhook, "enable-webhook", false, "Enable validation webhook. Requires TLS certificates to be configured.") + flag.StringVar(&kubeconfig, "kubeconfig", "", "Paths to a kubeconfig. Only required if out-of-cluster.") + flag.StringVar(&leaderElectionNamespace, "leader-election-namespace", "", "The namespace where the leader election resource will be created.") opts := zap.Options{ Development: true, @@ -89,6 +94,18 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) ctrl.Log.Info(fmt.Sprintf("version: %s", info.GetVersionString())) + var cfg *rest.Config + var err error + if kubeconfig != "" { + cfg, err = clientcmd.BuildConfigFromFlags("", kubeconfig) + } else { + cfg, err = ctrl.GetConfig() + } + if err != nil { + setupLog.Error(err, "unable to get kubeconfig") + os.Exit(1) + } + metricsServerOptions := metricsserver.Options{ BindAddress: metricsAddr, CertDir: metricsCertDir, @@ -101,12 +118,13 @@ func main() { }(), } - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, - Metrics: metricsServerOptions, - HealthProbeBindAddress: probeAddr, - LeaderElection: enableLeaderElection, - LeaderElectionID: "ba65f13e.readiness.node.x-k8s.io", + mgr, err := ctrl.NewManager(cfg, ctrl.Options{ + Scheme: scheme, + Metrics: metricsServerOptions, + HealthProbeBindAddress: probeAddr, + LeaderElection: enableLeaderElection, + LeaderElectionID: "ba65f13e.readiness.node.x-k8s.io", + LeaderElectionNamespace: leaderElectionNamespace, }) if err != nil { setupLog.Error(err, "unable to start manager") From 6b28f665c5d6292831875faecc7b4eeec4487cd6 Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Wed, 11 Mar 2026 19:06:38 +0000 Subject: [PATCH 2/9] add kubeadm example --- examples/static-pod/README.md | 48 +++++++++++++++++ examples/static-pod/kind-static-pod.yaml | 35 ++++++++++++ .../static-pod/node-readiness-controller.yaml | 54 +++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 examples/static-pod/README.md create mode 100644 examples/static-pod/kind-static-pod.yaml create mode 100644 examples/static-pod/node-readiness-controller.yaml diff --git a/examples/static-pod/README.md b/examples/static-pod/README.md new file mode 100644 index 0000000..b80038a --- /dev/null +++ b/examples/static-pod/README.md @@ -0,0 +1,48 @@ +# Running the Node Readiness Controller as a Static Pod + +This example demonstrates how to run the Node Readiness Controller as a **Static Pod** on the control-plane nodes. This is useful for self-managed clusters (e.g., `kubeadm`) where you want the controller to be available alongside other core components like the API server. + +## Key Features of this Setup + +1. **Non-Root Security:** The controller container runs as a non-root user (`UID 65532`), following security best practices. +2. **Permissions Handling:** Since `/etc/kubernetes/admin.conf` is typically restricted to `root:root (0600)`, an `initContainer` is used to copy the kubeconfig to a shared `emptyDir` volume and set readable permissions (`0644`) for the non-root manager process. +3. **High Availability:** The example configuration is compatible with multi-master HA setups, using leader election to ensure only one instance is active. + +## Files + +- `node-readiness-controller.yaml`: The Static Pod manifest. +- `kind-static-pod.yaml`: A Kind cluster configuration that mounts the manifest into control-plane nodes for testing. + +## Local Testing with Kind + +### 1. Build the Image +```bash +make docker-build IMG_PREFIX=controller IMG_TAG=latest +``` + +### 2. Create the HA Cluster +```bash +kind create cluster --config examples/static-pod/kind-static-pod.yaml --name nrr-static-test +``` + +### 3. Load the Image +```bash +kind load docker-image controller:latest --name nrr-static-test +``` + +### 4. Verify Pods +Static pods are managed by the Kubelet on each node. They will appear in the `kube-system` namespace: +```bash +kubectl get pods -n kube-system -l component=node-readiness-controller +``` + +### 5. Check Leader Election +```bash +kubectl get lease -n kube-system ba65f13e.readiness.node.x-k8s.io +``` + +## Production Deployment (e.g., kubeadm) + +1. Copy `node-readiness-controller.yaml` to the `/etc/kubernetes/manifests/` directory on each control-plane node. +2. Ensure the image specified in the manifest is available on the host (or in a registry the host can access). +3. The Kubelet will automatically detect and start the pod. diff --git a/examples/static-pod/kind-static-pod.yaml b/examples/static-pod/kind-static-pod.yaml new file mode 100644 index 0000000..a6aeb3a --- /dev/null +++ b/examples/static-pod/kind-static-pod.yaml @@ -0,0 +1,35 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +name: nrr-static-test +nodes: +- role: control-plane + extraMounts: + - hostPath: ./static-manifests/node-readiness-controller.yaml + containerPath: /etc/kubernetes/manifests/node-readiness-controller.yaml + readOnly: true +- role: control-plane + extraMounts: + - hostPath: ./static-manifests/node-readiness-controller.yaml + containerPath: /etc/kubernetes/manifests/node-readiness-controller.yaml + readOnly: true +- role: control-plane + extraMounts: + - hostPath: ./static-manifests/node-readiness-controller.yaml + containerPath: /etc/kubernetes/manifests/node-readiness-controller.yaml + readOnly: true +- role: worker + kubeadmConfigPatches: + - | + kind: JoinConfiguration + nodeRegistration: + kubeletExtraArgs: + node-labels: "reserved-for=worker" + register-with-taints: "readiness.k8s.io/NetworkReady=pending:NoSchedule" +- role: worker + kubeadmConfigPatches: + - | + kind: JoinConfiguration + nodeRegistration: + kubeletExtraArgs: + node-labels: "reserved-for=worker" + register-with-taints: "readiness.k8s.io/NetworkReady=pending:NoSchedule" diff --git a/examples/static-pod/node-readiness-controller.yaml b/examples/static-pod/node-readiness-controller.yaml new file mode 100644 index 0000000..1dcfcaf --- /dev/null +++ b/examples/static-pod/node-readiness-controller.yaml @@ -0,0 +1,54 @@ +apiVersion: v1 +kind: Pod +metadata: + name: node-readiness-controller + namespace: kube-system + labels: + component: node-readiness-controller + tier: control-plane +spec: + # Init container to prepare a readable kubeconfig for the non-root manager. + initContainers: + - name: prepare-kubeconfig + image: busybox:latest + imagePullPolicy: IfNotPresent + command: + - sh + - -c + - | + cp /etc/kubernetes/admin.conf /tmp/kubeconfig/admin.conf + chmod 644 /tmp/kubeconfig/admin.conf + volumeMounts: + - name: host-kubeconfig + mountPath: /etc/kubernetes/admin.conf + readOnly: true + - name: nrc-kubeconfig + mountPath: /tmp/kubeconfig + containers: + - name: manager + image: controller:latest + imagePullPolicy: IfNotPresent + command: + - /manager + args: + - --kubeconfig=/etc/kubernetes/nrc/admin.conf + - --leader-elect=true + - --leader-election-namespace=kube-system + - --metrics-bind-address=:8082 + - --health-probe-bind-address=:8081 + - --zap-log-level=info + securityContext: + runAsUser: 65532 + volumeMounts: + - name: nrc-kubeconfig + mountPath: /etc/kubernetes/nrc + readOnly: true + volumes: + - name: host-kubeconfig + hostPath: + path: /etc/kubernetes/admin.conf + type: File + - name: nrc-kubeconfig + emptyDir: {} + hostNetwork: true + priorityClassName: system-node-critical From a000070ee5dd8580416a15c06b51c3c736896bef Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Wed, 11 Mar 2026 19:07:22 +0000 Subject: [PATCH 3/9] change kubeconfig flag name --- cmd/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index c6699da..57f6d42 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -66,7 +66,7 @@ func main() { var enableWebhook bool var metricsSecure bool var metricsCertDir string - var kubeconfig string + var kubeconfigFlag string var leaderElectionNamespace string flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+ "Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.") @@ -81,7 +81,7 @@ func main() { "Enabling this will ensure there is only one active controller manager.") flag.BoolVar(&enableWebhook, "enable-webhook", false, "Enable validation webhook. Requires TLS certificates to be configured.") - flag.StringVar(&kubeconfig, "kubeconfig", "", "Paths to a kubeconfig. Only required if out-of-cluster.") + flag.StringVar(&kubeconfigFlag, "kubeconfig", "", "Paths to a kubeconfig. Only required if out-of-cluster.") flag.StringVar(&leaderElectionNamespace, "leader-election-namespace", "", "The namespace where the leader election resource will be created.") opts := zap.Options{ @@ -96,8 +96,8 @@ func main() { var cfg *rest.Config var err error - if kubeconfig != "" { - cfg, err = clientcmd.BuildConfigFromFlags("", kubeconfig) + if kubeconfigFlag != "" { + cfg, err = clientcmd.BuildConfigFromFlags("", kubeconfigFlag) } else { cfg, err = ctrl.GetConfig() } From 0694402dfac4a06463aa45e3bd5f4bacd535baeb Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Wed, 11 Mar 2026 22:00:10 +0000 Subject: [PATCH 4/9] move static-pod docs to book --- docs/book/src/user-guide/installation.md | 30 ++++++++++++++- examples/static-pod/README.md | 48 ------------------------ 2 files changed, 29 insertions(+), 49 deletions(-) delete mode 100644 examples/static-pod/README.md diff --git a/docs/book/src/user-guide/installation.md b/docs/book/src/user-guide/installation.md index df5a901..e60c28e 100644 --- a/docs/book/src/user-guide/installation.md +++ b/docs/book/src/user-guide/installation.md @@ -76,8 +76,36 @@ kubectl apply -k config/default You can enable optional components (Metrics, TLS, Webhook) by creating a `kustomization.yaml` that includes the relevant components from the `config/` directory. For reference on how these components can be combined, see the `deploy-with-metrics`, `deploy-with-tls`, `deploy-with-webhook`, and `deploy-full` targets in the projects [`Makefile`](https://github.com/kubernetes-sigs/node-readiness-controller/blob/main/Makefile). ---- +### Option 3: Deploy as a Static Pod (Control Plane) + +Running the controller as a **Static Pod** on control-plane nodes is useful for self-managed clusters (e.g., `kubeadm`) where you want the controller to be available alongside core components like the API server. + +#### Key Features of this Setup + +1. **Non-Root Security:** The controller container runs as a non-root user (`UID 65532`). +2. **Permissions Handling:** Since `/etc/kubernetes/admin.conf` is typically restricted to `root:root (0600)`, an `initContainer` is used to copy the kubeconfig to a shared `emptyDir` volume and set readable permissions (`0644`) for the non-root manager process. +3. **High Availability:** The configuration is compatible with multi-master HA setups, using leader election to ensure only one instance is active. + +#### Deployment Steps + +1. **Install CRDs**: + ```sh + kubectl apply -k config/crd + ``` + +2. **Prepare the Manifest**: + Use the example manifest in `examples/static-pod/node-readiness-controller.yaml`. This manifest includes the `initContainer` and necessary flags for leader election. +3. **Deploy to Nodes**: + Copy the manifest to the `/etc/kubernetes/manifests/` directory on each control-plane node. The Kubelet will automatically detect and start the pod. + +4. **Verify High Availability**: + In an HA setup, verify that one instance has acquired the leader lease: + ```sh + kubectl get lease -n kube-system ba65f13e.readiness.node.x-k8s.io + ``` + +--- ## Verification After installation, verify that the controller is running successfully. diff --git a/examples/static-pod/README.md b/examples/static-pod/README.md deleted file mode 100644 index b80038a..0000000 --- a/examples/static-pod/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Running the Node Readiness Controller as a Static Pod - -This example demonstrates how to run the Node Readiness Controller as a **Static Pod** on the control-plane nodes. This is useful for self-managed clusters (e.g., `kubeadm`) where you want the controller to be available alongside other core components like the API server. - -## Key Features of this Setup - -1. **Non-Root Security:** The controller container runs as a non-root user (`UID 65532`), following security best practices. -2. **Permissions Handling:** Since `/etc/kubernetes/admin.conf` is typically restricted to `root:root (0600)`, an `initContainer` is used to copy the kubeconfig to a shared `emptyDir` volume and set readable permissions (`0644`) for the non-root manager process. -3. **High Availability:** The example configuration is compatible with multi-master HA setups, using leader election to ensure only one instance is active. - -## Files - -- `node-readiness-controller.yaml`: The Static Pod manifest. -- `kind-static-pod.yaml`: A Kind cluster configuration that mounts the manifest into control-plane nodes for testing. - -## Local Testing with Kind - -### 1. Build the Image -```bash -make docker-build IMG_PREFIX=controller IMG_TAG=latest -``` - -### 2. Create the HA Cluster -```bash -kind create cluster --config examples/static-pod/kind-static-pod.yaml --name nrr-static-test -``` - -### 3. Load the Image -```bash -kind load docker-image controller:latest --name nrr-static-test -``` - -### 4. Verify Pods -Static pods are managed by the Kubelet on each node. They will appear in the `kube-system` namespace: -```bash -kubectl get pods -n kube-system -l component=node-readiness-controller -``` - -### 5. Check Leader Election -```bash -kubectl get lease -n kube-system ba65f13e.readiness.node.x-k8s.io -``` - -## Production Deployment (e.g., kubeadm) - -1. Copy `node-readiness-controller.yaml` to the `/etc/kubernetes/manifests/` directory on each control-plane node. -2. Ensure the image specified in the manifest is available on the host (or in a registry the host can access). -3. The Kubelet will automatically detect and start the pod. From c2160cdff020ad43cd6316cd7ed5bd7c5b9c3c30 Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Wed, 11 Mar 2026 22:15:42 +0000 Subject: [PATCH 5/9] cleanup doc --- docs/book/src/user-guide/installation.md | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/book/src/user-guide/installation.md b/docs/book/src/user-guide/installation.md index e60c28e..0d0bd23 100644 --- a/docs/book/src/user-guide/installation.md +++ b/docs/book/src/user-guide/installation.md @@ -80,30 +80,23 @@ You can enable optional components (Metrics, TLS, Webhook) by creating a `kustom Running the controller as a **Static Pod** on control-plane nodes is useful for self-managed clusters (e.g., `kubeadm`) where you want the controller to be available alongside core components like the API server. -#### Key Features of this Setup - -1. **Non-Root Security:** The controller container runs as a non-root user (`UID 65532`). -2. **Permissions Handling:** Since `/etc/kubernetes/admin.conf` is typically restricted to `root:root (0600)`, an `initContainer` is used to copy the kubeconfig to a shared `emptyDir` volume and set readable permissions (`0644`) for the non-root manager process. -3. **High Availability:** The configuration is compatible with multi-master HA setups, using leader election to ensure only one instance is active. +Refer to the `examples/static-pod/node-readiness-controller.yaml` for a detailed +example on deploying the controller as a static pod in a kind cluster. #### Deployment Steps -1. **Install CRDs**: - ```sh - kubectl apply -k config/crd - ``` - -2. **Prepare the Manifest**: - Use the example manifest in `examples/static-pod/node-readiness-controller.yaml`. This manifest includes the `initContainer` and necessary flags for leader election. +1. **Prepare the Manifest**: + Refer the example manifest in + `examples/static-pod/node-readiness-controller.yaml`. This manifest handles kubeconfig with a `initContainer` and necessary flags for leader election. -3. **Deploy to Nodes**: - Copy the manifest to the `/etc/kubernetes/manifests/` directory on each control-plane node. The Kubelet will automatically detect and start the pod. +2. **Deploy to Nodes**: + Use Ansible / Terraform to copy the manifest to the `/etc/kubernetes/manifests/` directory on each control-plane node. The Kubelet will automatically detect and start the pod. -4. **Verify High Availability**: - In an HA setup, verify that one instance has acquired the leader lease: +3. **Install CRDs**: ```sh - kubectl get lease -n kube-system ba65f13e.readiness.node.x-k8s.io + kubectl apply -k config/crd ``` + This is typically handled via a bootstrap script or post-install job in a `kubeadm` setup. --- ## Verification @@ -127,6 +120,13 @@ After installation, verify that the controller is running successfully. kubectl get crd nodereadinessrules.readiness.node.x-k8s.io ``` +4. **Verify High Availability**: + In a HA cluster, you could verify one instance has acquired the leader lease + as below: + ```sh + kubectl get lease -n ${NAMESPACE} ba65f13e.readiness.node.x-k8s.io + ``` + ## Uninstallation > **IMPORTANT**: Follow this order to avoid "stuck" resources. From 9289dbf4f57d94801a0d9109144de38e8f891bec Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Wed, 11 Mar 2026 22:20:48 +0000 Subject: [PATCH 6/9] refine installation docs --- docs/book/src/user-guide/installation.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/book/src/user-guide/installation.md b/docs/book/src/user-guide/installation.md index 0d0bd23..7a1c9e6 100644 --- a/docs/book/src/user-guide/installation.md +++ b/docs/book/src/user-guide/installation.md @@ -101,17 +101,19 @@ example on deploying the controller as a static pod in a kind cluster. --- ## Verification -After installation, verify that the controller is running successfully. +After installation, verify that the controller is running successfully. + +> **Note**: Replace `${NAMESPACE}` with the namespace where the controller is deployed (typically `nrr-system` for standard deployments, or `kube-system` for static pods). 1. **Check Pod Status**: ```sh - kubectl get pods -n nrr-system + kubectl get pods -n ${NAMESPACE} -l component=node-readiness-controller ``` - You should see a pod named `nrr-controller-manager-...` in `Running` status. + You should see the controller pods in `Running` status. 2. **Check Logs**: ```sh - kubectl logs -n nrr-system -l control-plane=controller-manager + kubectl logs -n ${NAMESPACE} -l component=node-readiness-controller ``` Look for "Starting EventSource" or "Starting Controller" messages indicating the manager is active. @@ -121,9 +123,9 @@ After installation, verify that the controller is running successfully. ``` 4. **Verify High Availability**: - In a HA cluster, you could verify one instance has acquired the leader lease - as below: + In an HA cluster, verify that one instance has acquired the leader lease: ```sh + # The lease namespace should match the controller's namespace (configured via --leader-election-namespace) kubectl get lease -n ${NAMESPACE} ba65f13e.readiness.node.x-k8s.io ``` @@ -151,6 +153,9 @@ The controller uses a **finalizer** (`readiness.node.x-k8s.io/cleanup-taints`) o # OR if using Kustomize kubectl delete -k config/default + + # OR if using Static Pods + # Remove the manifest from /etc/kubernetes/manifests/ on all control-plane nodes ``` 3. **Uninstall CRDs** (Optional): From 75fd8b20083bcfbd422eb9b6557de510cf93c333 Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Thu, 12 Mar 2026 02:02:12 +0000 Subject: [PATCH 7/9] update kind-static-pod example path --- examples/static-pod/kind-static-pod.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/static-pod/kind-static-pod.yaml b/examples/static-pod/kind-static-pod.yaml index a6aeb3a..f7092b4 100644 --- a/examples/static-pod/kind-static-pod.yaml +++ b/examples/static-pod/kind-static-pod.yaml @@ -4,17 +4,17 @@ name: nrr-static-test nodes: - role: control-plane extraMounts: - - hostPath: ./static-manifests/node-readiness-controller.yaml + - hostPath: ./examples/static-pod/node-readiness-controller.yaml containerPath: /etc/kubernetes/manifests/node-readiness-controller.yaml readOnly: true - role: control-plane extraMounts: - - hostPath: ./static-manifests/node-readiness-controller.yaml + - hostPath: ./examples/static-pod/node-readiness-controller.yaml containerPath: /etc/kubernetes/manifests/node-readiness-controller.yaml readOnly: true - role: control-plane extraMounts: - - hostPath: ./static-manifests/node-readiness-controller.yaml + - hostPath: ./examples/static-pod/node-readiness-controller.yaml containerPath: /etc/kubernetes/manifests/node-readiness-controller.yaml readOnly: true - role: worker From d92a46e023b5733dcfd119bc9bb94f6d93c01ebe Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Thu, 12 Mar 2026 02:03:41 +0000 Subject: [PATCH 8/9] remove kubeconfig as its available from clientgo --- cmd/main.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 57f6d42..877d094 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -27,7 +27,6 @@ import ( "go.uber.org/zap/zapcore" _ "k8s.io/client-go/plugin/pkg/client/auth" "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -66,7 +65,6 @@ func main() { var enableWebhook bool var metricsSecure bool var metricsCertDir string - var kubeconfigFlag string var leaderElectionNamespace string flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+ "Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.") @@ -81,7 +79,6 @@ func main() { "Enabling this will ensure there is only one active controller manager.") flag.BoolVar(&enableWebhook, "enable-webhook", false, "Enable validation webhook. Requires TLS certificates to be configured.") - flag.StringVar(&kubeconfigFlag, "kubeconfig", "", "Paths to a kubeconfig. Only required if out-of-cluster.") flag.StringVar(&leaderElectionNamespace, "leader-election-namespace", "", "The namespace where the leader election resource will be created.") opts := zap.Options{ @@ -94,18 +91,6 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) ctrl.Log.Info(fmt.Sprintf("version: %s", info.GetVersionString())) - var cfg *rest.Config - var err error - if kubeconfigFlag != "" { - cfg, err = clientcmd.BuildConfigFromFlags("", kubeconfigFlag) - } else { - cfg, err = ctrl.GetConfig() - } - if err != nil { - setupLog.Error(err, "unable to get kubeconfig") - os.Exit(1) - } - metricsServerOptions := metricsserver.Options{ BindAddress: metricsAddr, CertDir: metricsCertDir, @@ -118,7 +103,7 @@ func main() { }(), } - mgr, err := ctrl.NewManager(cfg, ctrl.Options{ + mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme, Metrics: metricsServerOptions, HealthProbeBindAddress: probeAddr, From 096d1bc56b8896a0cf1cec26a0837a7ae982fc6c Mon Sep 17 00:00:00 2001 From: Ajay Sundar Karuppasamy Date: Sun, 15 Mar 2026 12:29:20 +0000 Subject: [PATCH 9/9] change kind cluster name --- examples/static-pod/kind-static-pod.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/static-pod/kind-static-pod.yaml b/examples/static-pod/kind-static-pod.yaml index f7092b4..15c2d0c 100644 --- a/examples/static-pod/kind-static-pod.yaml +++ b/examples/static-pod/kind-static-pod.yaml @@ -1,6 +1,6 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 -name: nrr-static-test +name: nrr-static nodes: - role: control-plane extraMounts: