minikube apiserver.service-node-port-range 不喜欢逗号分隔的端口列表

minikube apiserver.service-node-port-range doesn't like comma separated list of ports

我可以配置 apiserver.service-node-port-range extra-config 的端口范围如 10000-19000 但是当我指定逗号分隔的端口列表时 17080,13306 minkube 不会启动它会 bootloop有以下错误

  initialization failed, will try again: wait: /bin/bash -c "sudo env PATH=/var/lib/minikube/binaries/v1.20.2:$PATH kubeadm init --config /var/tmp/minikube/kubeadm.yaml  --ignore-preflig
ht-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--var-lib-minikube,DirAvailable--var-lib-minikube-etcd,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailabl
e--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap,Mem,S
ystemVerification,FileContent--proc-sys-net-bridge-bridge-nf-call-iptables": Process exited with status 1
stdout:
[init] Using Kubernetes version: v1.20.2
[preflight] Running pre-flight checks
[preflight] The system verification failed. Printing the output from the verification:
KERNEL_VERSION: 5.10.26-1rodete1-amd64
DOCKER_VERSION: 20.10.5
OS: Linux
CGROUPS_CPU: enabled
CGROUPS_CPUSET: enabled
CGROUPS_DEVICES: enabled
CGROUPS_FREEZER: enabled
CGROUPS_MEMORY: enabled
CGROUPS_PIDS: enabled
CGROUPS_HUGETLB: enabled
[preflight] Pulling images required for setting up a Kubernetes cluster
.
.
.
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.

        Unfortunately, an error has occurred:
                timed out waiting for the condition

        This error is likely caused by:
                - The kubelet is not running
                - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)

        If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
                - 'systemctl status kubelet'
                - 'journalctl -xeu kubelet'

        Additionally, a control plane component may have crashed or exited when started by the container runtime.
        To troubleshoot, list all containers using your preferred container runtimes CLI.

        Here is one example how you may list all Kubernetes containers running in docker:
                - 'docker ps -a | grep kube | grep -v pause'
                Once you have found the failing container, you can inspect its logs with:
                - 'docker logs CONTAINERID'


stderr:

我检查了 kube-apiserver 并且只获取了端口范围。 minikube 是否支持以逗号分隔的端口列表?

--service-node-port-range <a string in the form 'N1-N2'> Default: 30000-32767

将此作为社区 Wiki 发布,请随时提供有关此主题的更多详细信息和发现。

我们可以找到有关以逗号分隔的端口和端口范围列表信息的唯一地方是 minikube documentation:

Increasing the NodePort range

By default, minikube only exposes ports 30000-32767. If this does not work for >you, you can adjust the range by using:

minikube start --extra-config=apiserver.service-node-port-range=1-65535

This flag also accepts a comma separated list of ports and port ranges.

另一方面来自k8s documentation:

--service-node-port-range <a string in the form 'N1-N2'> Default: 30000-32767

我已经用 k8s v 1.20 测试过这个,逗号分隔的端口列表也不适合我。 Kube-apiserver 接受两种方法:

set parses a string of the form "value", "min-max", or "min+offset", inclusive at both ends

--service-node-port-range=30100-31000   # using "min-max" approach
--service-node-port-range=25000+100     # using "min+offset" approach (valid ranges will be 25000-25100)

其他资源: