使用 virtualbox 在 ubuntu server 22.4 上安装 kubernetes

使用 virtualbox 在 ubuntu server 22.4 上安装 kubernetes

我已经在 Windows 笔记本电脑上安装了 VirtualBox。然后我安装了 ubuntu 服务器 22.4。

https://phoenixnap.com/kb/install-kubernetes-on-ubuntu

我已点击上面提到的链接。

这是我的 10-kubeadm.conf 文件

 # Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
Environment="KUBELET_EXTRA_ARGS=--fail-swap-on=false"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/default/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS

当我运行此命令时

sudo kubeadm init --control-plane-endpoint=master-node --upload-certs


W0122 12:30:59.668914   77279 version.go:104] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.txt": Get "https://dl.k8s.io/release/stable-1.txt": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
W0122 12:30:59.668985   77279 version.go:105] falling back to the local client version: v1.28.2
[init] Using Kubernetes version: v1.28.2
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR Port-10259]: Port 10259 is in use
        [ERROR Port-10257]: Port 10257 is in use
        [ERROR Port-10250]: Port 10250 is in use
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

当我尝试杀死所有这些 PID 时,它们只会重新启动。我已经卸载了 ubuntu 服务器并从头开始。但问题仍然存在,我总是停留在第 10 步

答案1

您需要确定使用此命令列出的端口是什么:

sudo netstat -tunlp

一旦你有了这个,你就可以看到哪个应用程序与 KubeCTL 实例冲突。

相关内容