DNS do Kubernetes em falta [MissingClusterDNS]

1

Eu configurei meu cluster de 1 mestre e 1 nó do guia a seguir. Instalação manual do CentOS

depois disso, estou apenas tentando implantar o painel (ou qualquer coisa para esse assunto) e recebo o seguinte erro em

kubectl get events

25m        1h          23        10.3.0.5                 Node                                                     Warning   MissingClusterDNS   {kubelet 10.3.0.5}          (events with common reason combined)
30m        1h          16        10.3.0.5                 Node                                                     Warning   MissingClusterDNS   {kubelet 10.3.0.5}          kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. pod: "kubernetes-dashboard-1975554030-cc9n1_kube-system(ebab5633-c9d1-11e6-a741-000d3af22f09)". Falling back to DNSDefault policy.
56m        56m         1         10.3.0.5                 Node                                                     Warning   MissingClusterDNS   {kubelet 10.3.0.5}          kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. pod: "busybox_default(9634cf12-c9d7-11e6-a741-000d3af22f09)". Falling back to DNSDefault policy.
26m        26m         2         10.3.0.5                 Node                                                     Warning   MissingClusterDNS   {kubelet 10.3.0.5}          kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. pod: "kubernetes-dashboard-1975554030-31rnp_kube-system(bdce120a-c9db-11e6-a741-000d3af22f09)". Falling back to DNSDefault policy.
...

Além disso, ao tentar chegar ao painel, recebo isso

curl http://localhost:8001/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "no endpoints available for service \"kubernetes-dashboard\"",
  "reason": "ServiceUnavailable",
  "code": 503
}

Outros registros e informações

kubectl cluster-info
Kubernetes master is running at http://localhost:8080

kubectl version
Client Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.0", GitCommit:"86dc49aa137175378ac7fba7751c3d3e7f18e5fc", GitTreeState:"clean", BuildDate:"2016-12-15T16:57:18Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.0", GitCommit:"86dc49aa137175378ac7fba7751c3d3e7f18e5fc", GitTreeState:"clean", BuildDate:"2016-12-15T16:57:18Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}

kubectl get nodes
NAME       STATUS    AGE
10.3.0.5   Ready     3h

kubectl get services --all-namespaces
NAMESPACE     NAME                   CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
default       kubernetes             10.254.0.1       <none>        443/TCP   1h
kube-system   kubernetes-dashboard   10.254.155.149   <nodes>       80/TCP    31m

kubectl get pods --all-namespaces
NAMESPACE     NAME                                    READY     STATUS             RESTARTS   AGE
kube-system   kubernetes-dashboard-1975554030-1ramq   0/1       CrashLoopBackOff   10         31m
    
por Rohit Hazra 24.12.2016 / 14:56

1 resposta

0

O painel do Kubernetes requer um serviço DNS de cluster em funcionamento.

Este é um manifesto que você pode usar para implantar o CoreDNS em seu cluster com o DNS em funcionamento.

Suponho que o DNS do seu cluster seja 10.254.0.10 com base em algumas das saídas acima.

Você deve ser capaz de salvar este código em um arquivo de texto (por exemplo, chamado k8s-dns.yaml) e instalá-lo com kubectl create -f k8s-dns.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns
  namespace: kube-system
data:
  Corefile: |
    .:53 {
        log stdout
        health
        # Replace cluster.local with your cluster domain
        kubernetes cluster.local
        proxy . /etc/resolv.conf
        cache 30
    }
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: coredns
  namespace: kube-system
  labels:
    k8s-app: coredns
    kubernetes.io/cluster-service: "true"
    kubernetes.io/name: "CoreDNS"
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: coredns
  template:
    metadata:
      labels:
        k8s-app: coredns
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
        scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
    spec:
      containers:
      - name: coredns
        image: rothgar/coredns:004
        imagePullPolicy: Always
        args: [ "-conf", "/etc/coredns/Corefile" ]
        volumeMounts:
        - name: config-volume
          mountPath: /etc/coredns
        ports:
        - containerPort: 53
          name: dns
          protocol: UDP
        - containerPort: 53
          name: dns-tcp
          protocol: TCP
        livenessProbe:
          httpGet:
            path: /health
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
      dnsPolicy: Default
      volumes:
        - name: config-volume
          configMap:
            name: coredns
            items:
            - key: Corefile
              path: Corefile
---
apiVersion: v1
kind: Service
metadata:
  name: coredns
  namespace: kube-system
  labels:
    k8s-app: coredns
    kubernetes.io/cluster-service: "true"
    kubernetes.io/name: "CoreDNS"
spec:
  selector:
    k8s-app: coredns
  # Replace with your cluster DNS IP
  clusterIP: 10.254.0.10
  ports:
  - name: dns
    port: 53
    protocol: UDP
  - name: dns-tcp
    port: 53
    protocol: TCP

Como um aparte. Sugiro seguir a documentação do kubeadm , pois ela está muito mais atualizada e fornecerá uma cluster totalmente funcional.

    
por 30.01.2017 / 05:58

Tags