Kubernetes: kube-dns Service Creation

2019-07-18 06:08发布

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条回答
做自己的国王
2楼-- · 2019-07-18 06:14

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.

查看更多
登录 后发表回答