I am trying to create Nodeport service in my EKS cluster however I am getting error as for: "network/minikube/orderers/services.yaml": map: map[name:endpoint] does not contain declared merge key: port
. Can anybody help me to fix the issue.
My service.yaml file
apiVersion: v1
kind: Service
metadata:
name: orderer0-service
labels: {
component: orderer0,
type: orderer
}
spec:
type: NodePort
ports:
- name: endpoint
- port: 7050
targetPort: 7050
nodePort: 30050
selector:
component: orderer0
type: orderer
ports:
is representing list of ports, where by -
you are separating the ports, (name, port, targetPort, nodePort) these four are combinedly representing one service port values, and you mistakenly included another list in (- port: 7050
), your yaml should be like below,
ports:
- name: endpoint
port: 7050
targetPort: 7050
nodePort: 30050
YAML:
apiVersion: v1
kind: Service
metadata:
name: orderer0-service
labels: {
component: orderer0,
type: orderer
}
spec:
type: NodePort
ports:
- name: endpoint
port: 7050
targetPort: 7050
nodePort: 30050
selector:
component: orderer0
type: orderer
The yaml has a problem.You don't need the -
infront of port
.It should be like below
apiVersion: v1
kind: Service
metadata:
name: orderer0-service
labels: {
component: orderer0,
type: orderer
}
spec:
type: NodePort
ports:
- name: endpoint
port: 7050
targetPort: 7050
nodePort: 30050
selector:
component: orderer0
type: orderer