Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to modify the port range of the kubernetes service nodeport type

Shulou Source: shulou.com Published: 2022-06-01 00:37:33 11月01日 Update

This article mainly shows you "how to modify the port range of kubernetes service nodeport type". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to modify the port range of kubernetes service nodeport type".

Kubernetes version 1.14.3

Provided port is not in the valid range. The range of valid ports is 30000-32767

Create service in Kubernetes (K8s) and use nodePort to expose external port 6379 Times error

The Service "redis" is invalid: spec.ports [0] .nodePort: Invalid value: 6379: provided port is not in the valid range. The range of valid ports is 30000-32767

Edit the kube-apiserver.yaml file

Vim / etc/kubernetes/manifests/kube-apiserver.yaml

one

Find the-- service-cluster-ip-range line and add the following to the next line of this line

-service-node-port-range=1-65535

The actual case content is as follows

ApiVersion: v1kind: Podmetadata: creationTimestamp: null labels: component: kube-apiserver tier: control-plane name: kube-apiserver namespace: kube-systemspec: containers:-command:-kube-apiserver-advertise-address=192.168.0.254-allow-privileged=true-authorization-mode=Node RBAC-client-ca-file=/etc/kubernetes/pki/ca.crt-enable-admission-plugins=NodeRestriction-enable-bootstrap-token-auth=true-etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt-etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt-etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key-etcd -servers= https://127.0.0.1:2379-insecure-port=0-kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt-kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key-kubelet-preferred-address-types=InternalIP ExternalIP Hostname-proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt-proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key-requestheader-allowed-names=front-proxy-client-requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt-requestheader-extra-headers-prefix=X-Remote-Extra-- -requestheader-group-headers=X-Remote-Group-requestheader-username-headers=X-Remote-User-secure-port=6443-service-account-key-file=/etc/kubernetes/pki/sa.pub-service-cluster-ip-range=10.1.0.0/16-service-node-port-range=1-65535

Finally restart kubelet

Systemctl daemon-reloadsystemctl restart kubelet

Execute kubectl create-f kube-service.yml again to achieve success.

The above is all the content of the article "how to modify the port range of kubernetes service nodeport type". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Content port type scope service one line article learning help success practice file times easy to understand more organization case version knowledge editing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia Redmi Docker vpn