日安
我正在尝试使用Java和Sping Boot 在DigitalOceand Kubernetes集群中部署一些微服务。第一个微服务是Eureka Server库,我正在尝试使用Google应用程序测试环境,然后继续部署其他微服务。
我遇到了下一个问题,即在DigitalOcean Kubernetes中实现两个Pod和一个LoadBalancer服务。
我的配置是:第一次部署:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-deployment-1
spec:
replicas: 1
selector:
matchLabels:
app: hello-deployment-1
role: metrol-network-service
template:
metadata:
labels:
app: hello-deployment-1
role: metrol-network-service
spec:
containers:
- name: hello
image: gcr.io/google-samples/hello-app:1.0
ports:
- containerPort: 8080
resources:
requests:
memory: "400Mi"
cpu: "200m"
limits:
memory: "500Mi"
cpu: "250m"
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 60
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 20
periodSeconds: 10
字符串
第二个部署是:
apiVersion: apps/v1
kind: Deployment
metadata:
name: metrol-eureka-server-deployment
spec:
replicas: 1
selector:
matchLabels:
app: metrol-eureka-server
role: metrol-network-service
template:
metadata:
labels:
app: metrol-eureka-server
role: metrol-network-service
spec:
containers:
- name: 'metrol-eureka-server'
image: crivera3/metrol-eureka-server:0.0.2
ports:
- containerPort: 8761
resources:
requests:
memory: "1000Mi"
cpu: "500m"
limits:
memory: "1100Mi"
cpu: "600m"
readinessProbe:
httpGet:
path: /actuator/health
port: 8761
initialDelaySeconds: 30
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8761
initialDelaySeconds: 20
periodSeconds: 10
型
LoadBalancer服务是:
apiVersion: v1
kind: Service
metadata:
name: metrol-network-service
annotations:
service.beta.kubernetes.io/do-loadbalancer-healthcheck-protocol: "http"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-path: "/actuator/health"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-port: "8761"
spec:
externalTrafficPolicy: Local
type: LoadBalancer
ports:
- port: 8761
targetPort: 8761
name: metrol-eureka
- port: 8080
targetPort: 8080
name: hello-deployment-1
selector:
role: metrol-network-service
型
LoadBalancer服务的结果:enter image description here
当我在Digital Ocean上应用此配置时,LoadBalancer和Droplet没有建立流量enter image description here
但是,如果我删除这个应用程序,并删除其中之一,并再次执行配置,LoadBalancer的工作正常.
证据#1 enter image description here
证据#2 enter image description here
证据3 enter image description here
证据4 enter image description here
换句话说,两个部署不能共存,但当我部署任何人时,只有一个部署工作得很好。
PD:
- 部署两个部署时的节点信息:已配置的资源:|资源|请求|限制||--|--|--||CPU| 1502米(79%)|850米(44%)||存储器|2526180480人(占77%)|2442294400人(占74%)|
- 仅部署一个部署时的节点信息:已分配的资源:|资源|请求|限制||--|--|--||CPU| 1302个月(68%)|600米(31%)||存储器|2106750080(占64%)名员工|1918006400人(占58%)|
I have looked information about this but I found did not fix this issue
型
1条答案
按热度按时间v9tzhpje1#
我一直在其他提供商的云中运行此配置,例如:Vultr或Linode(Akamai),此配置工作得更稳定。我认为此问题的主要原因是健康检查配置。例如:
字符串
在我的案例中,另一个特点是:我实现了Spring Cloud Netflix环境,在这种策略下,每个微服务都要在Eureka 服务器中进行HTTP请求注册是正常的,因此,健康检查涉及的更多。