我试图在我的GKE集群上部署Matabase,但是我的就绪探测失败了。
我构建在本地和获取本地主机上:3000/api/health,我获得了状态200,但在k8s上,它不起作用。
码头文件。我创建了自己的GitLab注册表的推送和构建。
FROM metabase/metabase:v0.41.6
EXPOSE 3000
CMD ["/app/run_metabase.sh" ]我的deployment.yaml
# apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: metaba-dev
spec:
selector:
matchLabels:
app: metaba-dev
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 50%
maxSurge: 100%
template:
metadata:
labels:
app: metaba-dev
spec:
restartPolicy: Always
imagePullSecrets:
- name: gitlab-login
containers:
- name: metaba-dev
image: registry.gitlab.com/team/metabase:dev-{{BUILD_NUMBER}}
command: ["/app/run_metabase.sh" ]
livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 60
periodSeconds: 10
readinessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 60
periodSeconds: 10
imagePullPolicy: Always
ports:
- name: metaba-dev-port
containerPort: 3000
terminationGracePeriodSeconds: 90我得到了这个错误
kubectl描述荚metaba-dev
Warning Unhealthy 61s (x3 over 81s) kubelet Readiness probe failed: Get "http://10.207.128.197:3000/api/health": dial tcp 10.207.128.197:3000: connect: connection refused
Warning Unhealthy 61s (x3 over 81s) kubelet Liveness probe failed: Get "http://10.207.128.197:3000/api/health": dial tcp 10.207.128.197:3000: connect: connection refused库贝克尔原木
Picked up JAVA_TOOL_OPTIONS: -Xmx1g -Xms1g -Xmx1g
Warning: environ value jdk-11.0.13+8 for key :java-version has been overwritten with 11.0.13
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2022-01-28 15:32:23,966 INFO metabase.util :: Maximum memory available to JVM: 989.9 MB
2022-01-28 15:33:09,703 INFO util.encryption :: Saved credentials encryption is ENABLED for this Metabase instance.
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html这里解决方案
我添加了initialDelaySeconds:到1200并检查日志,这是由于网络mypod无法连接到数据库,而当我检查日志时,我没有看到这个原因,因为我已经重新启动了,这是一个新的日志
发布于 2022-01-28 15:52:23
尝试将initialDelaySeconds: 60更改为100,您应该始终在容器中设置资源请求和限制,以避免探测失败,这是因为当应用程序开始触及资源限制时,kubernetes就会开始节流容器。
containers:
- name: app
image: images.my-company.example/app:v4
resources:
requests:
memory: "128Mi"
cpu: "250m"
limits:
memory: "100Mi"
cpu: "500m"https://stackoverflow.com/questions/70896213
复制相似问题