这里的type一定要和selector对齐,而不是和app:web对齐,如果和后者对齐,生成的service的类型还是ClusterIP(service/web2就出现这个问题),而不是NodePort
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: web
name: web3
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: web
type: NodePort
status:
loadBalancer: {}
标签:web,service,app,yaml,对齐,80,type
From: https://www.cnblogs.com/my_captain/p/16796627.html