我在从kubernetes.default.svc.cluster.local
命名空间外部解决default
时遇到问题
我正在每个命名空间上运行两个busybox:1.30 Pod,并且该名称仅从default
命名空间中成功解析
[admin@devsvr3 ~]$ kubectl exec -n default -ti busybox -- nslookup kubernetes
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: kubernetes
Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local
[admin@devsvr3 ~]$ kubectl exec -n namespace-dev -ti busybox -- nslookup kubernetes
Server: 10.96.0.10
Address: 10.96.0.10:53
** server can't find kubernetes.namespace-dev.svc.cluster.local: NXDOMAIN
*** Can't find kubernetes.svc.cluster.local: No answer
*** Can't find kubernetes.cluster.local: No answer
*** Can't find kubernetes.namespace-dev.svc.cluster.local: No answer
*** Can't find kubernetes.svc.cluster.local: No answer
*** Can't find kubernetes.cluster.local: No answer
[admin@devsvr3 ~]$
我在开放式环境中运行CentOS 7 kubernetes集群,并使用编织网CNI插件,这是我的CoreDNS配置
apiVersion: v1
data:
Corefile: |
.:53 {
log
errors
health
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
proxy . /etc/resolv.conf
cache 30
reload
loadbalance
}
kind: ConfigMap
metadata:
creationTimestamp: "2019-01-28T10:59:25Z"
name: coredns
namespace: kube-system
resourceVersion: "1177652"
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
uid: c6b5ddae-22eb-11e9-8689-0017a4770068
答案 0 :(得分:0)
实际上,按照您的步骤进行操作时,我遇到了相同的问题。但是,如果您使用此Yaml创建吊舱,则它可以正常运行。更改busybox映像似乎最终会导致您描述的错误。会尝试找出原因。但是目前这是解决方案。
SELECT *
FROM
(
SELECT REGEXP_REPLACE(string, '-G56', '') str
FROM test
) t
WHERE t.str ~ 'BCD-XYZE12'
;
,然后:
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: namespace-dev
spec:
containers:
- name: busybox
image: busybox:1.28
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
restartPolicy: Always
它按预期工作并here进行了解释。
kubectl exec -ti -n=namespace-dev busybox -- nslookup kubernetes.default