【发布时间】:2020-11-27 02:04:15
【问题描述】:
这是我尝试对 Kubernetes 配置文件执行的操作:
apiVersion: apps/v1
kind: Deployment
metadata:
name: selenium-hub
labels:
app: selenium-hub
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: selenium-hub
template:
metadata:
labels:
app: selenium-hub
spec:
containers:
- name: selenium-hub
image: selenium/hub
ports:
- containerPort: 4444
resources:
limits:
memory: "1000Mi"
cpu: ".5"
livenessProbe:
httpGet:
path: /wd/hub/status
port: 4444
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /wd/hub/status
port: 4444
initialDelaySeconds: 30
timeoutSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
externalTrafficPolicy: Local
ports:
- name: http
port: 4444
protocol: TCP
targetPort: 4444
selector:
app: selenium-hub
type: LoadBalancer
在 GKE 中,它创建一个带有 pod 的应用,然后是一个带有外部 IP 的负载均衡器。但是当我尝试通过http://LBIP:port 从外部访问该应用程序时,它不起作用。
那么我如何才能公开我首先创建的 pod?如果我只使用一个副本,是否需要 LB?
【问题讨论】:
-
请在您的代码前后添加```(三个反引号),以便保留缩进。另外请在问题描述而不是标题中分享您的代码。所有这些都将使我们更容易对其进行故障排除。
标签: kubernetes load google-kubernetes-engine