码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-04-14 18:11:04      阅读:910      评论:0      收藏:0      [点我收藏+]

标签:span   http   data   systemctl   rpo   dom   启动   replicat   amd   

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

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

标签:span   http   data   systemctl   rpo   dom   启动   replicat   amd   

原文地址:http://www.cnblogs.com/xiaoyu-10201/p/6710133.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!