kubesphere通过http域名方式连接私有仓库harbor获取不到镜像的问题解决

1、检查/etc/hosts是否配置了harbor域名解析;

2、检查/etc/docker/daemon.json是否按harbor域名配置了不安全访问方式insecure-registries;

3、若创建http密钥时能验证通过,但在创建pod时无法读取harbor中的镜像信息,则:

修改coredns

kubectl -n kube-system edit cm coredns

在Corefile下面修改
对应hosts文件的harbor的地址映射信息

apiVersion: v1
data:
  Corefile: |
    .:53 {
        errors
        health {
           lameduck 5s
        }
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
           pods insecure
           fallthrough in-addr.arpa ip6.arpa
           ttl 30
        }
        #此处hosts为新增内容
        hosts { 
           10.28.25.76 harbor.xugu.com
           fallthrough
        }
        prometheus :9153
        forward . /etc/resolv.conf {
           max_concurrent 1000
        }
        cache 30
        loop
        reload
        loadbalance
    }
kind: ConfigMap
metadata:
  creationTimestamp: 2024-08-05T02:17:54Z
  name: coredns
  namespace: kube-system
  resourceVersion: "227239"
  uid: b4417850-ca8e-4662-b645-8abcf1610c4f

删除旧的coredns的pod,系统会自动启用新的dns

kubectl delete -n kube-system pod `kubectl get pod -A|grep dns|awk '{print $2}'`

查看新的coredns的pod

kubectl get pod -A|grep dns

安装工具包验证域名问题

yum -y install bind-utils

验证node1的域名解析

nslookup xg-ljc-node1 ` kubectl get svc -A|grep dns|awk '{print $4}'`
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值