超酷小 发表于 2018-9-15 12:56:40

kubernetes 配置kubedns

apiVersion: extensions/v1beta1  kind: Deployment
  metadata:
  name: kube-dns
  namespace: kube-system
  labels:
  k8s-app: kube-dns
  kubernetes.io/cluster-service: "true"
  spec:
  #指定副本数
  replicas: 1
  # replicas: not specified here:
  # 1. In order to make Addon Manager do not reconcile this replicas parameter.
  # 2. Default is 1.
  # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on.
  strategy:
  rollingUpdate:
  maxSurge: 10%
  maxUnavailable: 0
  selector:
  matchLabels:
  k8s-app: kube-dns
  template:
  metadata:
  labels:
  k8s-app: kube-dns
  annotations:
  scheduler.alpha.kubernetes.io/critical-pod: ''
  scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
  spec:
  containers:
  - name: kubedns
  image: docker.io/ist0ne/kubedns-amd64:latest
  resources:
  # TODO: Set memory limits when we've profiled the container for large
  # clusters, then set request = limit to keep this container in

  # guaranteed>  # "burstable" category so the kubelet doesn't backoff from restarting it.
  limits:
  memory: 170Mi
  requests:
  cpu: 100m
  memory: 70Mi
  livenessProbe:
  httpGet:
  path: /healthz-kubedns
  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: 3
  timeoutSeconds: 5
  args:
  #指定一级域名
  - --domain=huangzai.com.
  - --dns-port=10053
  - --config-map=kube-dns
  #增加kube-master-url,指向k8s_master地址
  - --kube-master-url=http://192.168.3.216:8080
  # This should be set to v=2 only after the new image (cut from 1.5) has

  # been>  - --v=0
  env:
  - name: PROMETHEUS_PORT
  value: "10055"
  ports:
  - containerPort: 10053
  name: dns-local
  protocol: UDP
  - containerPort: 10053
  name: dns-tcp-local
  protocol: TCP
  - containerPort: 10055
  name: metrics
  protocol: TCP
  - name: dnsmasq
  image: docker.io/ist0ne/k8s-dns-dnsmasq-amd64:latest
  livenessProbe:
  httpGet:
  path: /healthz-dnsmasq
  port: 8080
  scheme: HTTP
  initialDelaySeconds: 60
  timeoutSeconds: 5
  successThreshold: 1
  failureThreshold: 5
  args:
  - --cache-size=1000
  - --no-resolv
  - --server=127.0.0.1#10053
  #注释掉
  #- --log-facility=-
  ports:
  - containerPort: 53
  name: dns
  protocol: UDP
  - containerPort: 53
  name: dns-tcp
  protocol: TCP
  # see: https://github.com/kubernetes/kubernetes/issues/29055 for details
  resources:
  requests:
  cpu: 150m
  memory: 10Mi
  - name: dnsmasq-metrics
  image: docker.io/ist0ne/dnsmasq-metrics-amd64:latest
  livenessProbe:
  httpGet:
  path: /metrics
  port: 10054
  scheme: HTTP
  initialDelaySeconds: 60
  timeoutSeconds: 5
  successThreshold: 1
  failureThreshold: 5
  args:
  - --v=2
  - --logtostderr
  ports:
  - containerPort: 10054
  name: metrics
  protocol: TCP
  resources:
  requests:
  memory: 10Mi
  - name: healthz
  image: docker.io/ist0ne/exechealthz-amd64:latest
  resources:
  limits:
  memory: 50Mi
  requests:
  cpu: 10m
  # Note that this container shouldn't really need 50Mi of memory. The
  # limits are set higher than expected pending investigation on #29688.
  # The extra memory was stolen from the kubedns container to keep the
  # net memory requested by the pod constant.
  memory: 50Mi
  args:
  - --cmd=nslookup kubernetes.default.svc.huangzai.com 127.0.0.1 >/dev/null
  - --url=/healthz-dnsmasq
  - --cmd=nslookup kubernetes.default.svc.huangzai.com 127.0.0.1:10053 >/dev/null
  - --url=/healthz-kubedns
  - --port=8080
  - --quiet
  ports:
  - containerPort: 8080
  protocol: TCP
  dnsPolicy: Default# Don't use cluster DNS.

页: [1]
查看完整版本: kubernetes 配置kubedns