Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report