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

Jenkins on Kubernetes service yaml parsing error

I’m following this Link to setup Jenkins on Kubernetes cluster. When I tried to apply jenkins-svc.yaml it fails with an error.

The environment information is mentioned below,

Environment:-

Kubernetes Version - v1.19.16
On-Premise Physical Server
Master - 1
Worker-2

jenkins-svc.yaml file content as follows,

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

apiVersion: v1
kind: Service
metadata:
  name: jenkins-ui-service
  namespace: jenkins
spec:
    type: ClusterIP # NodePort, LoadBalancer 
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
      # nodePort: 30100
      name: ui
  selector:
    app: jenkins
--- 
apiVersion: v1
kind: Service
metadata:
  name: jenkins-jnlp-service
  namespace: jenkins
spec:
    type: ClusterIP # NodePort, LoadBalancer
  ports:
    - port: 50000
      targetPort: 50000
  selector:
    app: jenkins

The error I get when I tried to apply jenkins-svc.yaml.

# kubectl  apply -f jenkins-svc.yaml -n jenkins
error: error parsing jenkins-svc.yaml: error converting YAML to JSON: yaml: line 7: did not find expected key

As per the above given link, I have following files.

jenkins-deployment.yaml
jenkins-pvc.yaml
jenkins-pv.yaml
jenkins-svc.yaml

Still I’m I missing something? Please let me know how do I solve this issue?

>Solution :

please check indentation of line 7 & 23. remove 2 extra spaces before "type" in spec section for both svc.

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