Kubernetes: kube-dns Service Creation

假装没事ソ 提交于 2020-01-15 05:04:22

问题


After writing a skydns-svc.yml file with the IP 192.168.3.10 I recieve the following error:

Error: The Service "kube-dns" is invalid:spec.clusterIP: Invalid value: "192.168.3.10": provided IP is not in the valid range

skydns-svc.yml

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

How is this not in a valid range and how could I go about resolving the error? Using V1.2


回答1:


You need to set the clusterIP to an IP in the "SERVICE_CLUSTER_IP_RANGE", which is a CIDR range (typically a /16 or smaller) passed to the kube-apiserver process in the --service-cluster-ip-range flag. If you pick any address in that range you should no longer receive the above error.



来源:https://stackoverflow.com/questions/37263927/kubernetes-kube-dns-service-creation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!