Skip to content

How to change the downstream Rancher Webhook port on a Host Network configuration

This document (000021383) is provided subject to the disclaimer at the end of this document.

Environment

Rancher 2.7.2+

Downstream (Rancher-managed) cluster with Host Network enabled on the webhook

Situation

When exposing the Rancher Webhook on a downstream (Rancher-managed) cluster to the Host Network (for example: https://ranchermanager.docs.rancher.com/v2.7/reference-guides/rancher-webhook#eks-cluster-with-calico-cni), another service may already be using port 9443/tcp on the Host Network and the Rancher Webhook needs to have its port changed to avoid port conflicts.

Resolution

Create a YAML file named 'rancher-config-portchange.yaml' with the following contents (replace the port '9444' with any other desired port number if needed):

apiVersion: v1
kind: ConfigMap
metadata:
  name: rancher-config
  namespace: cattle-system
  labels:
    app.kubernetes.io/part-of: "rancher"
data:
  rancher-webhook: |
      port: 9444
      global:
        hostNetwork: true

Then, apply the manifest above with the following command on the affected cluster:

kubectl apply -f rancher-config-portchange.yaml

Cause

On Rancher 2.7.2 and above, a dedicated webhook is deployed on clusters managed by Rancher (also known as downstream clusters). In scenarios where the default port of 9443 can conflict, for example, when using the Host Network and having another pod active on the same port (9443/tcp), the Rancher webhook would benefit from having its port changed to avoid any conflicts.

A practical example of such a scenario would be to use EKS with a custom CNI, which requires exposing the webhook on the Host Network for it to work properly: https://ranchermanager.docs.rancher.com/v2.7/reference-guides/rancher-webhook#eks-cluster-with-calico-cni.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.