Hello Community,
I am facing an issue while creating a service yaml file in for below question can you please look in to it.
Create a new service to access the web application using the service-definition-1.yaml file
Name:
webapp-service
Type:
NodePort
targetPort:
8080
port:
8080
nodePort:
30080
selector:
name:
simple-webapp
Error: kubectl create -f service-definition-1.yaml
error: error validating “service-definition-1.yaml”: error validating data: ValidationError(Service.metadata): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta: got “string”, expected “map”; if you choose to ignore these errors, turn validation off with --validate=false
controlplane ~ cat service-definition-1.yaml
apiVersion: v1
kind: Service
metadata:
name:webapp-service
spec:
type: Nodeport
ports:
- targetPort: 8080
port : 8080
nodePort: 30080
selector:
name: simple-webapp
Regards,
Challapuram