想在ubuntu22.04上部署k8s 1.26,但是apt install kubelet失败

想在ubuntu22.04上部署k8s 1.26,但是apt install kubelet失败

想在ubuntu22.04上部署k8s 1.26,但是apt install kubelet失败

$ apt-get install kubelet kubeadm kubectl

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 kubelet : Depends: iptables (>= 1.4.21) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

$ apt-get install iptables

The following packages were automatically installed and are no longer required:
  libflashrom1 libftdi1-2 libip6tc2
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  iptables
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
9 not fully installed or removed.
Need to get 0 B/261 kB of archives.
After this operation, 1,613 kB of additional disk space will be used.
(Reading database ... 73635 files and directories currently installed.)
Preparing to unpack .../iptables_1.4.21-1ubuntu1_amd64.deb ...
Unpacking iptables (1.4.21-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/iptables_1.4.21-1ubuntu1_amd64.deb (--unpack):
 unable to open '/usr/sbin/iptables-apply.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
           Errors were encountered while processing:
 /var/cache/apt/archives/iptables_1.4.21-1ubuntu1_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)


答案1

我使用它在我的 ubuntu 服务器上安装 kubectl,并且运行良好。

snap install kubectl --classic

snap install kubeadm --classic

snap install kuberlet --classic

然后,检查版本

kubectl version --client

參考文獻:

使用其他包管理进行安装

使用本机包管理

答案2

尝试:

apt autoremove --purge
apt install iptables

答案3

我建议尝试一下这个:

sudo dpkg --configure -a
sudo apt-get -f install
sudo apt-get update

如果这两个执行良好,则再试一次

apt-get install kubelet kubeadm kubectl

相关内容