Kubernetes部署ethereum主网节点

  sre

5fd9c65542e05694.jpg_fo742.jpg

DockerImage

https://geth.ethereum.org/docs/install-and-build/installing-geth#run-inside-docker-container
https://hub.docker.com/r/ethereum/client-go

pvc ethereum-disk

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ethereum-disk
  namespace: sre
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: "300Gi"
  volumeName: 
  storageClassName: nfs-trojan

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ethereum
  namespace: sre
spec:
  replicas: 1
  selector:
    matchLabels:
      rpc: ethereum
  template:
    metadata:
      labels:
        rpc: ethereum
    spec:
      containers:
      - name: ethereum
        image: ethereum/client-go
        imagePullPolicy: IfNotPresent
        restartPolicy: OnFailure
        ports:
        - containerPort: 8545
          name: rpc-http
          protocol: TCP
        - containerPort: 8546
          name: rpc-ws
          protocol: TCP
        - containerPort: 8547
          name: graphql-api
          protocol: TCP
        - containerPort: 30303
          name: p2p-tcp
          protocol: TCP
        - containerPort: 30303
          name: p2p-udp
          protocol: UDP
        volumeMounts:
        - name: ethereum-disk
          mountPath: /root/.ethereum
      volumes:
       - name: ethereum-disk
         persistentVolumeClaim:
           claimName: ethereum-disk 

svc

kind: Service
apiVersion: v1
metadata:
  labels:
    rpc: ethereum
  name: ethereum
  namespace: sre
spec:
  type: NodePort
  ports:
  - name: rpc-http
    port: 8545
    targetPort: 8545
    nodePort: 30545
    protocol: TCP
  - name: ws-http
    port: 8546
    targetPort: 8546
    nodePort: 30546
    protocol: TCP
  - name: graphql-api
    port: 8547
    targetPort: 8547
    nodePort: 30547
    protocol: TCP
  - name: p2p-tcp
    port: 30303
    targetPort: 30303
    nodePort: 30303
    protocol: TCP
  - name: p2p-udp
    port: 30303
    targetPort: 30303
    nodePort: 30303
    protocol: UDP
  selector:
    rpc: ethereum

LEAVE A COMMENT

Captcha Code