Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Kubernates: Unknown field "ClusterIP" in io.k8s.api.core.v1.ServiceSpec

I am working with spring boot with microservices. I dockerize my all microservices and now I am trying to create resource in kubernates cluster. I get error while create resource in cluster through running kubectl apply.

Here down is my configuration file for kubernates:

eureka-server.yml

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

kind: ConfigMap
apiVersion: v1
metadata:
  name: eureka-cm
data:
  eureka_service_address: http://eureka-0.eureka:8761/eureka

---

apiVersion: v1
kind: Service
metadata:
  name: eureka
  labels:
    app: eureka
spec:
  ClusterIP: None
  ports: 
  - port: 8761
    name: eureka
  selector:
    app: eureka

---

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: eureka
spec:
  selector:
    matchLabels:
      app: eureka
  serviceName: "eureka"
  replicas: 1
  template:
    metadata:
      labels:
        app: eureka
    spec:
      containers:
      - name: eureka
        image: username/eureka-server:latest
        imagePullPolicy: Always
        ports:
          - containerPort: 8761
        env:
          - name: EUREKA_SERVER_ADDRESS
            valueFrom:
              configMapKeyRef:
                name: eureka-cm
                key: eureka_service_address

---

apiVersion: v1
kind: Service
metadata:
  name: eureka-lb
  labels:
    app: eureka
spec:
  selector:
    app: eureka
  type: NodePort
  ports:
    - port: 80
      targetPort: 8761

Configuration file in spring boot for eureka server:

application.yml

server:
  port: 8761
eureka:
  instance:
    hostname: "${HOSTNAME}.eureka"
  client:
    registerWithEureka: false
    fetchRegistry: false
    service-url:
      defaultZone: ${EUREKA_SERVER_ADDRESS}
  server:
    waitTimeInMsWhenSyncEmpty: 0

Here down is my error I got while create resource in kubernates cluster:

error: error validating "./eureka-server.yml": error validating data: ValidationError(Service.spec): unknown field "ClusterIP" in io.k8s.api.core.v1.ServiceSpec; if you choose to ignore these errors, turn validation off with --validate=false

>Solution :

Well the error message you get is essentially the answer to your question. The field ClusterIP does not exist, but it is actually called clusterIP, which you can easily find out by reading the API reference.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading