我正在尝试将网络服务部署到 Google 的 Kontainer 引擎。我创建了一个集群cluster size: 4 AND total cores: 8
。在我的 yaml 配置中,我正在为我的三个服务创建部署,并Service
公开这些服务以及ingress
处理路由。
这是我的yaml:
kind: Deployment
apiVersion: apps/v1
metadata:
name: nodeapp-deployment
labels:
app: nodeapp
spec:
replicas: 3 #We always want more than 1 replica for HA
selector:
matchLabels:
app: nodeapp
template:
metadata:
labels:
app: nodeapp
spec:
containers:
- name: wishlist # svc name
image: karthequian/wishlist:1.0 #Dockerhub image
ports:
- containerPort: 8080 #Exposes the port 8080 of the container
env:
- name: wishlist-port #Env variable key passed to container that is read by app
value: "8080" # Value of the env port.
- name: catalog # svc name
image: karthequian/wishlist-catalog:1.0 #Dockerhub image
ports:
- containerPort: 8081 #Exposes the port 8080 of the container
env:
- name: catalog-port #Env variable key passed to container that is read by app
value: "8081" # Value of the env port.
- name: auth # svc name
image: karthequian/wishlist-auth:1.0 #Dockerhub image
ports:
- containerPort: 8082 #Exposes the port 8080 of the container
env:
- name: auth-port #Env variable key passed to container that is read by app
value: "8082" # Value of the env port.
kind: Service
apiVersion: v1
metadata:
name: nodeapp-service
labels:
app: nodeapp-service
namespace: default
spec:
type: ClusterIP
selector:
app: nodeapp
ports:
- name: wishlist-port
protocol: TCP
port: 8080
- name: catalog-port
protocol: TCP
port: 8081
- name: auth-port
protocol: TCP
port: 8082
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nodeapp-service
labels:
app: nodeapp-service
spec:
rules:
- host:
http:
paths:
- path: /wishlist
backend:
serviceName: nodeapp-service
servicePort: 8080
- path: /products
backend:
serviceName: nodeapp-service
servicePort: 8081
- path: /login
backend:
serviceName: nodeapp-service
servicePort: 8081
它返回一个令人困惑的错误:
请帮帮我!
提前致谢!