K8S 部署 coredns
参考https://mp.weixin.qq.com/s/PV1GTtIQ2oVjrIAZ1ED0Ng
·
方式 1,使用 lizhenliang 提供的文件安装 coredns
K8s 的域名全称为 <service-name>.<namespace>.svc.cluster.local
1. 部署步骤:
kubectl apply -f coredns.yaml
kubectl delete -f coredns.yaml
2. 部署前的准备操作:
docker pull lizhenliang/ingress-nginx-controller:v0.49.0
docker pull nginx:latest
3. 测试
进入容器内
kubectl run -it --rm dns-test-0313-2 --image=harbor.dev-fql.com/k8s/sre/bigdata/busybox:latest sh
kubectl exec -it presto-coordinator-84bc9bd7bb-47rqg -- /bin/bash
测试命令
cat /etc/resolv.conf
env | grep -i kubernetes
env | grep 10.96.0.1
nslookup kubernetes
nslookup kubernetes.default.svc.cluster.local
nslookup kubernetes-dashboard.kubernetes-dashboard.svc.cluster.local
nslookup kube-dns.kube-system.svc.cluster.local
nslookup presto-coordinator-service.default.svc.cluster.local
dig kubernetes.default.svc.cluster.local
dig -t A kubernetes.default.svc.cluster.local
dig -t A kubernetes.default.svc.cluster.local +short
dig -t A kubernetes.default.svc.cluster.local @10.96.0.10
dig -t A kubernetes.default.svc.cluster.local @10.96.0.10 +short
截图记录:
方式 2,使用官网的文件 coredns.yaml.base 安装
cd kubernetes-master/cluster/addons/dns/coredns
CLUSTER_DNS_DOMAIN="cluster.local"
CLUSTER_DNS_SVC_IP="10.64.0.2"
CLUSTER_DNS_LIMIT_MEMORY="170Mi"
sed -i -e "s@__DNS__DOMAIN__@${CLUSTER_DNS_DOMAIN}@" \
-e "s@__DNS__SERVER__@${CLUSTER_DNS_SVC_IP}@" \
-e "s@__DNS__MEMORY__LIMIT__@${CLUSTER_DNS_LIMIT_MEMORY}@" \
coredns.yaml.base
参考
https://mp.weixin.qq.com/s/PV1GTtIQ2oVjrIAZ1ED0Ng
https://jimmysong.io/kubernetes-handbook/practice/coredns.html
https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/coredns/coredns.yaml.base
https://www.cnblogs.com/jasonminghao/p/12250965.html
https://www.kancloud.cn/lingchen_cloud/kubernetes/2069629
https://github.com/coredns/deployment/tree/master/kubernetes
https://github.com/kubernetes/ingress-nginx
https://kubernetes.github.io/ingress-nginx/deploy/baremetal/
https://hub.docker.com/r/lizhenliang/ingress-nginx-controller
更多推荐
已为社区贡献4条内容
所有评论(0)