我的配置:
apiVersion: v1
kind: ServiceAccount
metadata:
name: external-dns
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: external-dns
rules:
- apiGroups: [""]
resources: ["services"]
verbs: ["get","watch","list"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get","watch","list"]
- apiGroups: ["extensions"]
resources: ["ingresses"]
verbs: ["get","watch","list"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list"]
- apiGroups: ["networking.istio.io"]
resources: ["gateways"]
verbs: ["get","watch","list"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: external-dns-viewer
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: external-dns
subjects:
- kind: ServiceAccount
name: external-dns
namespace: kube-system
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: external-dns
namespace: kube-system
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: external-dns
spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.opensource.zalan.do/teapot/external-dns:latest
args:
- --source=ingress
- --source=istio-gateway
- --domain-filter=xxx
- --policy=upsert-only
- --provider=azure
volumeMounts:
- name: azure-config-file
mountPath: /etc/kubernetes
readOnly: true
volumes:
- name: azure-config-file
secret:
secretName: azuredns-config
正在解析Istio网关对象并正在创建DNS记录(这发生在前一段时间,我现在在日志中看不到任何内容)。由于某种原因,未解析入口记录。我尝试添加--source=service
并使用external-dns.alpha.kubernetes.io/hostname: my.host.name
注释服务,也没有效果。
有什么想法吗?看起来不错,但不起作用。入口有效,如果我手动创建DNS记录入口,则cert-manager可以创建证书。
答案 0 :(得分:2)
我建议以适当的云提供商角色运行https://github.com/kubernetes-incubator/external-dns,例如AWS中的IAM角色,允许修改Route53记录。
对于Azure:https://github.com/kubernetes-incubator/external-dns/blob/master/docs/tutorials/azure.md
运行它时,请确保已启用入口源:https://github.com/helm/charts/blob/master/stable/external-dns/values.yaml#L8-L12
它具有调试日志记录,因此您可以精确检查记录中发生了什么。
答案 1 :(得分:2)
该问题是由于nginx-ingress没有将其IP地址发布到入口资源状态字段。 GH问题:https://github.com/kubernetes-incubator/external-dns/issues/456
--log-level=debug
帮助识别问题。通过将其添加到nginx入口控制器部署中进行了修复:
- --publish-service=kube-system/nginx-ingress-controller
- --update-status