我有以下用于运行比特币的kubernetes deployment.yml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: bitcoin
namespace: prod
spec:
serviceName: bitcoinrpc-service
replicas: 2
selector:
matchLabels:
app: bitcoin-node
template:
metadata:
annotations:
sidecar.istio.io/inject: "false" #because it needs to discover and connect to other peers
sidecar.istio.io/proxyImage: docker.io/istio/proxyv2:0.8.0
labels:
app: bitcoin-node
spec:
containers:
- name: bitcoin-node-mainnet
image: <my image>
imagePullPolicy: Always
ports:
- containerPort: 8332
- containerPort: 38832
env:
- name: RPC_USER
valueFrom:
secretKeyRef:
name: secrets
key: bitcoind_rpc_username
- name: RPC_PASSWORD
valueFrom:
secretKeyRef:
name: secrets
key: bitcoind_rpc_password
- name: RPC_ALLOW_IP
value: "0.0.0.0/0"
- name: RPC_PORT
value: "8332"
- name: PORT
value: "8333"
- name: RPC_THREADS
value: "64"
- name: RPC_TIMEOUT
value: "300"
- name: SERVER
value: "1"
- name: TX_INDEX
value: "1"
- name: ADDR_INDEX
value: "1"
- name: MAX_MEMPOOL
value: "10000"
- name: DBCACHE
value: "4096"
- name: MEMPOOL_EXPIRY
value: "336"
- name: ZMQPUBHASHBLOCK
value: "tcp://*:38832"
- name: ZMQPUBHASHTX
value: "tcp://*:38832"
- name: ZMQPUBRAWTX
value: "tcp://*:38832"
volumeMounts:
- name: bitcoin-chaindata
mountPath: /root/.bitcoin
resources:
requests:
memory: "8Gi" # 8 GB
cpu: "3000m" # 3 CPUs
limits:
memory: "16Gi" # 16 GB
cpu: "3000" # 3 CPUs
livenessProbe:
httpGet:
path: /rest/chaininfo.json
port: 8332
initialDelaySeconds: 120 #wait this period after staring fist time
periodSeconds: 240 # polling interval
timeoutSeconds: 60 # wish to receive response within this time period
readinessProbe:
httpGet:
path: /rest/chaininfo.json
port: 8332
initialDelaySeconds: 120 #wait this period after staring fist time
periodSeconds: 240 # polling interval
timeoutSeconds: 60
command: ["/bin/ash"]
args: ["-c","/app/bitcoin/bin/bitcoind -printtoconsole \
-pid=/root/.bitcoin/bitcoind.pid \
-rest \
-port=${PORT} \
-daemon=0 \
-rpcuser=${RPC_USER} \
-rpcpassword=${RPC_PASSWORD} \
-rpcport=${RPC_PORT} \
-rpcallowip=${RPC_ALLOW_IP} \
-rpcthreads=${RPC_THREADS} \
-server=${SERVER} \
-txindex=${TX_INDEX} \
-maxmempool=${MAX_MEMPOOL} \
-dbcache=${DBCACHE} \
-mempoolexpiry=${MEMPOOL_EXPIRY} \
-rpcworkqueue=500 \
-zmqpubhashblock=${ZMQPUBHASHBLOCK} \
-zmqpubhashtx=${ZMQPUBHASHTX} \
-zmqpubrawtx=${ZMQPUBRAWTX} \
-addresstype=legacy"]
# -rpctimeout=${RPC_TIMEOUT} \
# -addrindex=${ADDR_INDEX} \
volumeClaimTemplates:
- metadata:
name: bitcoin-chaindata
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: fast
resources:
requests:
storage: 500Gi
因为我将最大CPU使用量限制为16GB,所以我希望两个Pod都使用小于16GB的内存。 但是,我可以在stackdriver上看到,其中一个Pod大约使用12GB,而另一个Pod则高达32GB。 在什么情况下会发生?
我有一个 2 x 35GB 集群。
答案 0 :(得分:1)
我们将能够在resources
处控制container level
,并由此可以在pod level
处进行控制(pod cpu限制是其中所有容器的限制之和)。
我认为我们可以跨复制进行控制。