failed to resolve image to digest: Get “https://index.docker.io/v2/“: dial tcp: lookup index.docker.

使用kn create service时抛出如下问题:

(base) ubuntu@master:~/Projects/socc23$ kn service create network-intensive --image docker.io/{username}/{imagename} --force
Warning: Kubernetes default value is insecure, Knative may default this to secure in a future release: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation, spec.template.spec.containers[0].securityContext.capabilities, spec.template.spec.containers[0].securityContext.runAsNonRoot, spec.template.spec.containers[0].securityContext.seccompProfile
Replacing service $imagename in namespace 'default':

  0.048s Configuration $imagename does not have any ready Revision.
  0.321s ...
  0.362s Configuration $imagename is waiting for a Revision to become ready.
  6.359s Revision $imagename"-00013" failed with message: Unable to fetch image docker.io/{username}/{imagename}: failed to resolve image to digest: Get "https://index.docker.io/v2/": dial tcp: lookup index.docker.io on 10.96.0.10:53: server misbehaving.
  6.378s Configuration "network-intensive" does not have any ready Revision.
Error: RevisionFailed: Revision $imagename"-00013" failed with message: Unable to fetch image docker.io/{username}/{imagename}: failed to resolve image to digest: Get "https://index.docker.io/v2/": dial tcp: lookup index.docker.io on 10.96.0.10:53: server misbehaving.

上述问题的原因是DNS配置有问题,需要在/etc/resolv.conf添加nameserver信息,添加方式如下,添加完成后重新启动server/VM,以使/etc/resolv.conf中的内容生效。

https://www.tecmint.com/set-permanent-dns-nameservers-in-ubuntu-debian/

sudo apt update
sudo apt install resolvconf
sudo systemctl start resolvconf.service
sudo systemctl enable resolvconf.service
sudo systemctl status resolvconf.service

sudo nano /etc/resolvconf/resolv.conf.d/head #添加如下信息
nameserver 8.8.8.8 
nameserver 8.8.4.4

sudo systemctl restart resolvconf.service
sudo systemctl restart systemd-resolved.service
sudo reboot

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值