设置资源限制时杀死POD

问题描述 投票:0回答:1
resources.limits

,那么Pod要么不起作用,要么会遇到类似的错误:

resources.limits
。如果从逻辑上讲,此POD应该具有相似的资源限制而不指定
Unable to connect to the server: net/http: TLS handshake timeout
resources.limits
    
我怀疑容器使用的内存比您预期的要多,因为您已经配置了运行的livese探针:

apiVersion: apps/v1 kind: StatefulSet metadata: name: cassandra spec: serviceName: cassandra replicas: 1 selector: matchLabels: app: cassandra template: metadata: labels: app: cassandra spec: containers: - name: cassandra image: sevabek/cassandra:latest ports: - containerPort: 9042 volumeMounts: - mountPath: /var/lib/cassandra name: cassandra-storage livenessProbe: exec: command: - cqlsh - -e - "SELECT release_version FROM system.local;" initialDelaySeconds: 120 periodSeconds: 30 timeoutSeconds: 10 failureThreshold: 2 resources: requests: memory: "3500Mi" cpu: "1700m" limits: memory: "4Gi" cpu: "2000m" volumeClaimTemplates: - metadata: name: cassandra-storage spec: accessModes: - ReadWriteOnce resources: requests: storage: 3Gi
kubernetes cassandra
1个回答
0
投票

          livenessProbe:
            exec:
              command:
                - cqlsh
                - -e
                - "SELECT release_version FROM system.local;"
            initialDelaySeconds: 120
            periodSeconds: 30
            timeoutSeconds: 10
            failureThreshold: 2
是一个成熟的Python应用程序,因此它意味着它消耗了大量资源来运行。使用它只是为了检查Cassandra是否每30秒“活着”才是有点过多的。 如果CQL端口上的客户端连接正在侦听clastra(默认为

cqlsh
),则将其视为运行。如果出于任何原因出现问题(例如,磁盘故障),Cassandra将自动停止接受连接并关闭CQL端口。
启用通过

9042

运行CQL
SELECT

语句,我建议使用低级TCP检查使用Linux实用程序,例如:

cqlsh

netstat

如果您使用轻量级的livese探测器,则Cassandra容器应使用明显更少的资源。欢呼!
	
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.