我正在运行一个kind
集群并部署了一个ubuntu
kubectl运行ubunt-test -rm -i -tty-映像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容器时,相同的update命令可以工作。
码头运行-it ubuntu
然后运行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
命令在主机和码头容器上都正常工作。我不知道这种集群吊舱有什么问题。有猜到吗?
发布于 2022-11-22 11:39:17
由Google服务替换计算机上使用的名称服务器( DNS )。
sudo rm -f /etc/resolv.conf
sudo su
echo "nameserver 8.8.8.8" > /etc/resolv.conf
通过运行sudo vim /etc/default/docker
更新默认的停靠程序DNS,并取消注释下面的行
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
然后用sudo service docker restart
重新启动码头
https://stackoverflow.com/questions/74521789
复制相似问题