218 lines
4.7 KiB
YAML
218 lines
4.7 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: nac-node
|
|
namespace: nac-blockchain
|
|
labels:
|
|
app: nac-node
|
|
version: v1.0.0
|
|
spec:
|
|
replicas: 3
|
|
selector:
|
|
matchLabels:
|
|
app: nac-node
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxSurge: 1
|
|
maxUnavailable: 0
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: nac-node
|
|
version: v1.0.0
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9090"
|
|
prometheus.io/path: "/metrics"
|
|
spec:
|
|
serviceAccountName: nac-node
|
|
securityContext:
|
|
runAsUser: 1000
|
|
runAsGroup: 1000
|
|
fsGroup: 1000
|
|
containers:
|
|
- name: nac-node
|
|
image: nac-blockchain/node:latest
|
|
imagePullPolicy: Always
|
|
ports:
|
|
- name: http-rpc
|
|
containerPort: 8545
|
|
protocol: TCP
|
|
- name: ws-rpc
|
|
containerPort: 8546
|
|
protocol: TCP
|
|
- name: p2p-tcp
|
|
containerPort: 30303
|
|
protocol: TCP
|
|
- name: p2p-udp
|
|
containerPort: 30303
|
|
protocol: UDP
|
|
- name: metrics
|
|
containerPort: 9090
|
|
protocol: TCP
|
|
env:
|
|
- name: NAC_NETWORK
|
|
value: "mainnet"
|
|
- name: NAC_LOG_LEVEL
|
|
value: "info"
|
|
- name: NAC_RPC_HOST
|
|
value: "0.0.0.0"
|
|
- name: NAC_RPC_PORT
|
|
value: "8545"
|
|
- name: NAC_WS_PORT
|
|
value: "8546"
|
|
- name: NAC_P2P_PORT
|
|
value: "30303"
|
|
- name: NAC_DATA_DIR
|
|
value: "/data/nac"
|
|
envFrom:
|
|
- configMapRef:
|
|
name: nac-config
|
|
- secretRef:
|
|
name: nac-secrets
|
|
volumeMounts:
|
|
- name: nac-data
|
|
mountPath: /data/nac
|
|
- name: config
|
|
mountPath: /data/nac/config
|
|
readOnly: true
|
|
resources:
|
|
requests:
|
|
cpu: "2"
|
|
memory: "4Gi"
|
|
limits:
|
|
cpu: "4"
|
|
memory: "8Gi"
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- nac-node
|
|
- health
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 30
|
|
timeoutSeconds: 10
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- nac-node
|
|
- health
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
startupProbe:
|
|
exec:
|
|
command:
|
|
- nac-node
|
|
- health
|
|
initialDelaySeconds: 0
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 30
|
|
volumes:
|
|
- name: nac-data
|
|
persistentVolumeClaim:
|
|
claimName: nac-data-pvc
|
|
- name: config
|
|
configMap:
|
|
name: nac-config
|
|
affinity:
|
|
podAntiAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
labelSelector:
|
|
matchExpressions:
|
|
- key: app
|
|
operator: In
|
|
values:
|
|
- nac-node
|
|
topologyKey: kubernetes.io/hostname
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: nac-node
|
|
namespace: nac-blockchain
|
|
labels:
|
|
app: nac-node
|
|
spec:
|
|
type: LoadBalancer
|
|
selector:
|
|
app: nac-node
|
|
ports:
|
|
- name: http-rpc
|
|
port: 8545
|
|
targetPort: 8545
|
|
protocol: TCP
|
|
- name: ws-rpc
|
|
port: 8546
|
|
targetPort: 8546
|
|
protocol: TCP
|
|
- name: p2p-tcp
|
|
port: 30303
|
|
targetPort: 30303
|
|
protocol: TCP
|
|
- name: p2p-udp
|
|
port: 30303
|
|
targetPort: 30303
|
|
protocol: UDP
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: nac-data-pvc
|
|
namespace: nac-blockchain
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 500Gi
|
|
storageClassName: fast-ssd
|
|
---
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: nac-node-hpa
|
|
namespace: nac-blockchain
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: nac-node
|
|
minReplicas: 3
|
|
maxReplicas: 10
|
|
metrics:
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 70
|
|
- type: Resource
|
|
resource:
|
|
name: memory
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 80
|
|
behavior:
|
|
scaleDown:
|
|
stabilizationWindowSeconds: 300
|
|
policies:
|
|
- type: Percent
|
|
value: 50
|
|
periodSeconds: 60
|
|
scaleUp:
|
|
stabilizationWindowSeconds: 0
|
|
policies:
|
|
- type: Percent
|
|
value: 100
|
|
periodSeconds: 15
|
|
- type: Pods
|
|
value: 2
|
|
periodSeconds: 15
|
|
selectPolicy: Max
|