修改kubernetes服务 nodeport 类型的端口范围

kubernetes 版本 1.14.3

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

在 Kubernetes(k8s) 创建 service 使用nodePort 暴露 外部端口6379 时报错
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

编辑 kube-apiserver.yaml文件

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

找到 --service-cluster-ip-range 这一行,在这一行的下一行增加 如下内容

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

实际 案例内容如

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    component: kube-apiserver
    tier: control-plane
  name: kube-apiserver
  namespace: kube-system
spec:
  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

最后 重启 kubelet

systemctl daemon-reload
systemctl restart kubelet

再执行kubectl create -f kube-service.yml 即可成功

发布了377 篇原创文章 · 获赞 143 · 访问量 164万+
展开阅读全文

sql,outside valid range for the datatype INTEGER.

12-23

Account在mysql数据库中类型为varchar(20).Account有个值是‘o001’. 使用dbutils,执行以下函数 public Ordinaryusers findUserByAccount(String Account) { String sql="select * from ordinaryusers where Account='o001'"; try{ QueryRunner runner =new QueryRunner(DaoUtils.getSource()); return runner.query(sql, new BeanHandler<Ordinaryusers>(Ordinaryusers.class)); }catch(Exception e){ e.printStackTrace(); throw new RuntimeException(e); } } 报错:java.sql.SQLException: '1.7722222222E10' in column '5' is outside valid range for the datatype INTEGER. 采用普通连接数据库的方式调用以下函数 public Ordinaryusers findUserByAccount1(String Account) { Connection connection = null; PreparedStatement pStatement = null; ResultSet rSet = null; String sql="select * from ordinaryusers where Account='o001'"; Ordinaryusers obj = new Ordinaryusers(); try { connection = Connect.getConnection(); pStatement = connection.prepareStatement(sql); rSet = pStatement.executeQuery(); while(rSet.next()) { obj.setAccount(rSet.getString(1)); obj.setPassword(rSet.getString(2)); } }catch (Exception e) { e.printStackTrace(); }finally { try { Connect.close(rSet, pStatement, connection); }catch (Exception e) { e.printStackTrace(); } } return obj; } 就没有问题,实验了多次,发现第一个函数只要是o开头的数字就会出错,Account如果是其他字符串目前没问题,是不是dbutils框架里面有把字符串先转换为int的操作导致溢出? 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览