-
Choerodon平台版本: 0.6.0
-
遇到问题的执行步骤:
我需要内网假域名部署,于是自搭建了一个dns
dnsmasq -q -d -h -R -H /tmp/hosts
其中/tmp/hosts为 (服务器本机内网ip 我自己的域名)
192.168.31.188 gitlab.breezesoft.cn
192.168.31.188 minio.breezesoft.cn
192.168.31.188 harbor.breezesoft.cn
192.168.31.188 chart.breezesoft.cn
192.168.31.188 api.breezesoft.cn
192.168.31.188 notify.breezesoft.cn
192.168.31.188 devops.breezesoft.cn
192.168.31.188 c7n.breezesoft.cn
192.168.31.188 wiki.breezesoft.cn
经测试dns是否正常:
root@ubuntu:~/k8s/c7nctl-0.19.0# nslookup wiki.breezesoft.cn 192.168.31.188
Server: 192.168.31.188
Address: 192.168.31.188#53
Name: wiki.breezesoft.cn
Address: 192.168.31.188
没有任何问题
我创建了coredns的configmap kube-dns.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: kube-dns
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: EnsureExists
data:
tubDomains: |
{"breezesoft.cn":["192.168.31.188"]}
upstreamNameservers: |
["8.8.8.8", "8.8.4.4"]
执行:
kubectl create -f kube-dns.yaml
configmap/kube-dns created
启停coredns
kubectl scale deployment -n kube-system --replicas=0 coredns
10s后
kubectl scale deployment -n kube-system --replicas=2 coredns
配置dnstest.yaml文件;
touch dnstest.yaml
vim dnstest.yaml
apiVersion: v1
kind: Pod
metadata:
name: dnstest
namespace: default
spec:
dnsPolicy: ClusterFirst
containers:
- name: busybox
image: busybox
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
restartPolicy: Always
创建Pod
kubectl create -f dnstest.yaml
nslookup查询wiki.breezesoft.cn,返回定义的ip地址
root@ubuntu:~/k8s/c7nctl-0.19.0# kubectl exec -it dnstest nslookup wiki.breezesoft.cn
Server: 10.244.64.10
Address: 10.244.64.10:53
** server can't find wiki.breezesoft.cn: NXDOMAIN
*** Can't find wiki.breezesoft.cn: No answer
command terminated with exit code 1
-
文档地址:
-
环境信息(如:节点信息):
-
报错日志:
-
原因分析:
个人感觉是通过configMap 配置了coredns,却没有生效,但是不知道如何生效 -
疑问:
希望大佬能协助解决如何让自搭建的dns服务器接入coredns,并且能够提供帮助使其生效,如何排查问题(因为自己对这方面新手).