apiVersion: apps/v1
kind: Deployment
metadata:
name: dev-backend
namespace: dapr-demo03
labels:
app: app-backend
service: service-backend
spec:
replicas: 3
selector:
matchLabels:
app: dev-backend
template:
metadata:
labels:
app: dev-backend
annotations:
dapr.io/enabled: "true"
dapr.io/app-id: "backend"
dapr.io/app-port: "80"
dapr.io/config: "dapr-config"
spec:
containers:
- name: backend
image: dockerhub/backend:0.0.1
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 80
protocol: TCP
---
kind: Service
apiVersion: v1
metadata:
name: service-backend
namespace: dapr-demo03
labels:
app: dev-backend
service: service-backend
spec:
type: NodePort
selector:
app: dev-backend
ports:
- protocol: TCP
port: 80 #内部pods间通信的端口,service端口
targetPort: 80 #容器端口
nodePort: 31001 #对外端口
name: http
- protocol: TCP
port: 50001
targetPort: 50001
nodePort: 31002
name: dapr-grpc
标签:kubernetes,service,部署,app,dev,name,dapr,backend
From: https://www.cnblogs.com/wafulo/p/18358387