Kublr-provisioned Kubernetes clusters expose Kubernetes API on a port 443 or 6443 by default depending on the target environment (e.g. cloud or on-prem). Sometimes it becomes necessary to change this port to a different value on an existing cluster. It may be doneusing the procedure described in this article.


Note that the procedure may require a partial or full downtime so plan accordingly.


1. Change the port number in the cluster specification and run the cluster update:

spec:
  network:
    apiServerSecurePort: 2443


2. When the cluster admin kubeconfig file is updated and becomes available for download, download it and configure kubectl for using it


3. Delete in-cluster default kubernetes API service; Kubernetes will automatically recreate it after a few seconds with the new port number

kubectl delete -n default svc kubernetes


4. Wait for the cluster to recover and become healthy