在 ubuntu pod 中以实物 kubernetes 集群运行 apt-get 更新会给出明文签名文件无效,出现"NOSPLIT"错误



我正在运行一个kind集群并部署了一个ubuntu pod

kubectl run ubuntu -test——rm -i——tty——image ubuntu——bash

然后我尝试在shell上运行apt-get update。输出为


Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease                                       
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Err:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://security.ubuntu.com/ubuntu jammy-security InRelease' is not signed.
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is not signed.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

现在,当我使用docker运行ubuntu容器时,相同的更新命令可以工作。

docker run -it ubuntu bash

执行apt-get update命令,显示成功。输出为:

Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]                                        
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]                              
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [767 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]                         
Get:8 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [616 kB]                    
Get:9 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [4642 B]              
Get:10 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [522 kB]             
Get:11 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]                            
Get:12 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]                       
Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [955 kB]                 
Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [573 kB]               
Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [8056 B]               
Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [918 kB]                     
Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [7275 B]               
Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [3175 B]                   
Fetched 24.7 MB in 33s (753 kB/s)                                                                      
Reading package lists... Done

apt-get update命令在主机和docker容器上都可以正常工作。我不知道善良的群集舱有什么问题。

替换Google公共DNS服务在机器上使用的名称服务器(DNS)。

sudo rm -f /etc/resolv.conf
sudo su
echo "nameserver 8.8.8.8" > /etc/resolv.conf

通过运行sudo vim /etc/default/docker更新默认的docker DNS并取消以下行

DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

然后用sudo service docker restart重新启动docker

相关内容

最新更新