Home > Net >  Is it ppossiible to change default kubelet port 10250
Is it ppossiible to change default kubelet port 10250

Time:11-25

My kubernetes cluster is running in a restricted environment where we are unable to open ports as we want(only a range of ports are allowed for customized use), Some how I have started the kubernetes API server(6443 by default) on a allowed port using the config options with 'kubeadm init' , is there any way to change the default port of 10250 (kubelet API)?

CodePudding user response:

The port is set in the kube-apiserver.yaml by the option

- --secure-port=6443

Changing this value and restarting the api server should solve your problem.

When creating a new cluster you can use the option

--apiserver-bind-port <port> 

to start the api-server on a different port

CodePudding user response:

Kubelet port can be changed from default 10250 by passing an argument to KubeletConfiguration:

Field Description
port int32 port is the port for the Kubelet to serve on. The port number must be between 1 and 65535, inclusive. Default: 10250

By default it resides in:

  • /var/lib/kubelet/config

For this configuration to be available from the start (from kubeadm init ...) I'd check following documentation:

Configure kubelets using kubeadm

It is possible to configure the kubelet that kubeadm will start if a custom KubeletConfiguration API object is passed with a configuration file like so kubeadm ... --config some-config-file.yaml.

By calling kubeadm config print init-defaults --component-configs KubeletConfiguration you can see all the default values for this structure.

It is also possible to apply instance-specific patches over the base KubeletConfiguration. Have a look at Customizing the kubelet for more details.

Kubernetes.io: Docs: Setup: Production environment: Tools: Kubeadm: Control plane flags: Customizing the kubelet

  • Related