
Windows ラップトップに VirtualBox をインストールしました。その後、Ubuntu Server 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 インスタンスと競合しているかがわかります。