• kubernetes 1.3 使用skydns + kube2dns +etcd部署DNS服务器


    1. 直接从Docker中拉取skydns,kube2dns,etcd容器,放到一个Pod中

    • kube2sky:1.14
    • etcd:2.0.9
    • skydns-amd64

    2. 创建RC

    apiVersion: v1
    kind: ReplicationController
    metadata:
      name: kube-dns-v6
      namespace: default
      labels:
        k8s-app: kube-dns
        version: v6
        kubernetes.io/cluster-service: "true"
    spec:
      replicas: 1
      selector:
        k8s-app: kube-dns
        version: v6
      template:
        metadata:
          labels:
            k8s-app: kube-dns
            version: v6
            kubernetes.io/cluster-service: "true"
        spec:
          containers:
          - name: etcd
            image: 109.105.46.94:5000/dns/etcd:2.0.9
            command:
            - /usr/local/bin/etcd
            - -listen-client-urls
            - http://0.0.0.0:2379,http://0.0.0.0:4001
            - -advertise-client-urls
            - http://127.0.0.1:2379,http://127.0.0.1:4001
            - -initial-cluster-token
            - skydns-etcd
          - name: kube2sky
            #image: 109.105.46.94:5000/dns/kube2sky:1.11
            image: 109.105.46.94:5000/dns/kube2sky:1.14
            resources:
              limits:
                cpu: 100m
                memory: 50Mi
            command:
            - /kube2sky
           # - -kube_master_url=http://109.105.46.94:8080
           # - -domain=cluster.local
            - --kube-master-url=http://109.105.46.94:8080
            - --domain=cluster.local
          - name: skydns
            image:  109.105.46.94:5000/dns/skydns-amd64
            resources:
            command:
            - /skydns
            - -machines=http://localhost:4001
            - -addr=0.0.0.0:53
            - -domain=cluster.local.
            ports:
            - containerPort: 53
              name: dns
              protocol: UDP
            - containerPort: 53
              name: dns-tcp
              protocol: TCP
          dnsPolicy: Default

    3.创建SVC

    apiVersion: v1
    kind: Service
    metadata:
      name: kube-dns
      namespace: default
      labels:
        k8s-app: kube-dns
        kubernetes.io/cluster-service: "true"
        kubernetes.io/name: "KubeDNS"
    spec:
      selector:
        k8s-app: kube-dns
      clusterIP: 192.168.3.100
      ports:
      - name: dns
        port: 53
        protocol: UDP
      - name: dns-tcp
        port: 53
        protocol: TCP

    4. 启动dns:

    kubectl create -f skydns-etcd-rc.yaml
    kubectl create -f skydns-etcd-svc.yaml

    5.修改各node节点上的/etc/kubernetes/kubelet.service配置文件,增加启动参数:

    --cluster-dns=192.168.3.100 
    --cluster-domain=cluster.local

    6.重启各节点:

    systemctl daemon-reload
    systemctl restart kubelet
  • 相关阅读:
    (第七周)评论alpha发布
    (第六周)工作总结
    (第六周)团队项目6
    (第六周)团队项目5
    (第六周)团队项目4
    (第六周)团队项目燃尽图
    (第六周)团队项目3
    (第六周)课上Scrum站立会议演示
    Java第二次作业第五题
    Java第二次作业第四题
  • 原文地址:https://www.cnblogs.com/xiaoyu-10201/p/6710133.html
Copyright © 2020-2023  润新知