使用skydns-rc.yaml.base模板文件创建kubedns容器失败

时间:2016-07-19 06:49:44

标签: kubernetes kube-dns

我使用skydns-rc.yaml.base(/kubernetes-release-1.3/cluster/addons/dns/sky ..)文件来创建k8s dns服务。但是kubedns容器总是无法创建。

编辑后的元素信息显示如下:

命名空间:kube-system 替换为默认
PILLAR__DNS__REPLICAS 1 替换 - domain = PILLAR__DNS__DOMAIN。替换为 - domain = cluster.local
PILLAR__FEDERATIONS__DOMAIN__MAP 已删除

整个skydns-rc.yaml.base模板文件显示如下:

var countDownDiv = document.getElementById('countDown');
window.setInterval(intervalCountDown, 1000);
var counter = 5;
function intervalCountDown() {

  countDownDiv.innerHTML = counter--;
}

其他信息:

群集服务ip范围是10.254.0.0/16
域名是cluster.local
命名空间是默认的

执行语句后 kubectl描述pod kube-dns-v18 结果显示如下

apiVersion: v1
kind: ReplicationController
metadata:
  name: kube-dns-v18
  **namespace: kube-system**
  labels:
    k8s-app: kube-dns
    version: v18
    kubernetes.io/cluster-service: "true"
spec:
  replicas: **\_\_PILLAR\_\_DNS\_\_REPLICAS\_\_**
  selector:
    k8s-app: kube-dns
    version: v18
  template:
    metadata:
      labels:
        k8s-app: kube-dns
        version: v18
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
      - name: kubedns
        image: gcr.io/google_containers/kubedns-amd64:1.6
        resources:
          # TODO: Set memory limits when we've profiled the container for large
          # clusters, then set request = limit to keep this container in
          # guaranteed class. Currently, this container falls into the
          # "burstable" category so the kubelet doesn't backoff from restarting it.
          limits:
            cpu: 100m
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 100Mi
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
        readinessProbe:
          httpGet:
            path: /readiness
            port: 8081
            scheme: HTTP
          # we poll on pod startup for the Kubernetes master service and
          # only setup the /readiness HTTP server once that's available.
          initialDelaySeconds: 30
          timeoutSeconds: 5
        args:
        # command = "/kube-dns"
        - --domain=**\_\_PILLAR\_\_DNS\_\_DOMAIN\_\_.**
        - --dns-port=10053
        **\_\_PILLAR\_\_FEDERATIONS\_\_DOMAIN\_\_MAP\_\_**
        ports:
        - containerPort: 10053
          name: dns-local
          protocol: UDP
        - containerPort: 10053
          name: dns-tcp-local
          protocol: TCP
      - name: dnsmasq
        image: gcr.io/google_containers/kube-dnsmasq-amd64:1.3
        args:
        - --cache-size=1000
        - --no-resolv
        - --server=127.0.0.1#10053
        ports:
        - containerPort: 53
          name: dns
          protocol: UDP
        - containerPort: 53
          name: dns-tcp
          protocol: TCP
      - name: healthz
        image: gcr.io/google_containers/exechealthz-amd64:1.0
        resources:
          # keep request = limit to keep this container in guaranteed class
          limits:
            cpu: 10m
            memory: 20Mi
          requests:
            cpu: 10m
            memory: 20Mi
        args:
        - -cmd=nslookup kubernetes.default.svc.**\_\_PILLAR\_\_DNS\_\_DOMAIN\_\_** 127.0.0.1 >/dev/null && nslookup kubernetes.default.svc.**\_\_PILLAR\_\_DNS\_\_DOMAIN\_\_** 127.0.0.1:10053 >/dev/null
        - -port=8080
        - -quiet
        ports:
        - containerPort: 8080
          protocol: TCP
      dnsPolicy: Default  # Don't use cluster DNS.

1 个答案:

答案 0 :(得分:1)

您必须在args中设置kube-master-url。 例如:

    # command = "/kube-dns"
    - --domain=fool.bar.
    - --dns-port=10053
    - --kube-master-url=http://8.9.6.4:8080