How to set service-node-port-range and then be able to deploy services using the new port range?

后端 未结 2 2015
北恋
北恋 2021-01-19 13:11

I have a requirement that a test server should use the port range 20000 - 22767

I edited the kubeadm-config with the command

kubectl edit cm

相关标签:
2条回答
  • 2021-01-19 13:36

    I too couldn't find any docs on kubeadm configuration. The following works for me:

    # your current k8s version
    KUBE_VERSION=v1.14.1
    KUBEADM_CONFIG=kubeadm-config.yaml
    
    # save current kubeadm config
    kubeadm config view > $KUBEADM_CONFIG
    
    # add desired port range
    vi kubeadm-config.yaml
    
      apiServer:
        extraArgs:
          authorization-mode: Node,RBAC
    +       service-node-port-range: 20000-22767
    
    # save kubeadm config into a configmap
    kubeadm config upload from-file --config $KUBEADM_CONFIG
    
    # check changes
    sudo kubeadm upgrade diff --config $KUBEADM_CONFIG
    
    # apply changes
    sudo kubeadm upgrade apply $KUBE_VERSION --config $KUBEADM_CONFIG
    
    0 讨论(0)
  • 2021-01-19 13:56

    It is possible to update the service-node-port-rangefrom it's default values.

    I updated the file /etc/kubernetes/manifests/kube-apiserver.yaml with --service-node-port-range=20000-22767.

    The apiserver was restarted and the port range was updated.

    I wrote a blog post about it.

    0 讨论(0)
提交回复
热议问题