0

I want to run Geth's RPC server automatically when deploy it's pod. The pod is created from an official docker Geth image(ehtereum/client-go) on docker hub.
But I can't deploy the pod with error Fatal: Error starting protocol stack: listen tcp: lookup "192.168.1.10": no such host.

My deploy.yaml is here.

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: chaindatastorage
spec:
  capacity:
    storage: 1000Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-ssd-storage
  local:
    path: /k8sNodeData/ethDataDir
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: disktype
          operator: In
          values:
          - ssd
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: chaindatavolumeclaim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 1000Gi
  storageClassName: local-ssd-storage
---
apiVersion: v1
kind: Service
metadata:
  name: geth-port
spec:
  type: NodePort
  ports:
    - name: geth-sync-port
      port: 30303
      targetPort: 30303
      nodePort: 30303
    - name: geth-rpc-port
      port: 8545
      targetPort: 8545
      nodePort: 8545
  selector:
    name: gethnode
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gethnodedeployment
  labels:
    name: gethnode
spec:
  replicas: 1
  selector:
    matchLabels:
      name: gethnode
  template:
    metadata:
      labels:
        name: gethnode
    spec:
      containers:
      - name: gethnode
        image: ethereum/client-go
        args:
        - "--syncmode=full"
        - "--maxpeers=80"
        - "--cache=8192"
        - "--http"
        - "--http.addr=\"192.168.1.10\""
        - "--http.port=8545"
        volumeMounts:
          - name: gethchaindata
            mountPath: /root/.ethereum
        resources:
          limits:
            memory: 20480Mi
            cpu: 4000m
      volumes:
        - name: gethchaindata
          persistentVolumeClaim:
            claimName: chaindatavolumeclaim
---

The results of kubectl logs of the pod is here.

INFO [10-03|09:40:33.482] Starting Geth on Ethereum mainnet... 
INFO [10-03|09:40:33.483] Maximum peer count                       ETH=80 LES=0 total=80
INFO [10-03|09:40:33.483] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
ERROR[10-03|09:40:33.483] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[10-03|09:40:33.483] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[10-03|09:40:33.483] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[10-03|09:40:33.483] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[10-03|09:40:33.483] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[10-03|09:40:33.483] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
INFO [10-03|09:40:33.483] Set global gas cap                       cap=25000000
INFO [10-03|09:40:33.483] Allocated trie memory caches             clean=2.00GiB dirty=2.00GiB
INFO [10-03|09:40:33.483] Allocated cache and file handles         database=/root/.ethereum/geth/chaindata cache=4.00GiB handles=524288
ERROR[10-03|09:40:34.483] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=3 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[10-03|09:40:34.483] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=3 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[10-03|09:40:34.483] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=3 err="failed to initialize libusb: libusb: unknown error [code -99]"
INFO [10-03|09:40:34.769] Opened ancient database                  database=/root/.ethereum/geth/chaindata/ancient
INFO [10-03|09:40:34.825] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: 7280000 Petersburg: 7280000 Istanbul: 9069000, Muir Glacier: 9200000, YOLO v1: <nil>, Engine: ethash}"
INFO [10-03|09:40:34.825] Disk storage enabled for ethash caches   dir=/root/.ethereum/geth/ethash count=3
INFO [10-03|09:40:34.825] Disk storage enabled for ethash DAGs     dir=/root/.ethash               count=2
INFO [10-03|09:40:34.826] Initialising Ethereum protocol           versions="[65 64 63]" network=1 dbversion=8
INFO [10-03|09:40:37.518] Loaded most recent local header          number=10974617 hash="d28c04…5fe44a" td=17763879313328271327648 age=1d4h43m
INFO [10-03|09:40:37.519] Loaded most recent local full block      number=10973423 hash="92578b…ae09c1" td=17759925126330650308055 age=1d9h14m
INFO [10-03|09:40:37.519] Loaded most recent local fast block      number=10974617 hash="d28c04…5fe44a" td=17763879313328271327648 age=1d4h43m
INFO [10-03|09:40:37.521] Loaded local transaction journal         transactions=0 dropped=0
INFO [10-03|09:40:37.521] Regenerated local transaction journal    transactions=0 accounts=0
INFO [10-03|09:40:37.522] Starting peer-to-peer node               instance=Geth/v1.9.23-unstable-9d1e2027-20200930/linux-amd64/go1.15.2
INFO [10-03|09:40:37.576] New local node record                    seq=52227 id=78ab8e1d111e4ab5 ip=127.0.0.1 udp=30303 tcp=30303
INFO [10-03|09:40:37.577] Started P2P networking                   self=enode://0b9ee2182b4382638cd77fc8b4369d00b4c14cc6c46d4c71d84a9a9fc191cab75c6566b78a42ddcf4a4d00ba9057747588750f518133bf821cd09e69d769ba0b@127.0.0.1:30303
INFO [10-03|09:40:37.580] IPC endpoint opened                      url=/root/.ethereum/geth.ipc
INFO [10-03|09:40:37.581] IPC endpoint closed                      url=/root/.ethereum/geth.ipc
Fatal: Error starting protocol stack: listen tcp: lookup "192.168.1.10": no such host
Fatal: Error starting protocol stack: listen tcp: lookup "192.168.1.10": no such host

And the results of kubectl get pods -o wide -A is here.

NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE     IP             NODE        NOMINATED NODE   READINESS GATES
default       intelnuc-mysql-deployment-9685c849-q6c9j   1/1     Running   0          8d      10.244.2.35    intelnuc    <none>           <none>
kube-system   coredns-66bff467f8-gbf9r                   1/1     Running   0          31d     10.244.0.2     k8smaster   <none>           <none>
kube-system   coredns-66bff467f8-xg72w                   1/1     Running   0          31d     10.244.0.3     k8smaster   <none>           <none>
kube-system   etcd-k8smaster                             1/1     Running   0          31d     192.168.1.30   k8smaster   <none>           <none>
kube-system   kube-apiserver-k8smaster                   1/1     Running   1          2d22h   192.168.1.30   k8smaster   <none>           <none>
kube-system   kube-controller-manager-k8smaster          1/1     Running   3          31d     192.168.1.30   k8smaster   <none>           <none>
kube-system   kube-flannel-ds-amd64-gcg5c                1/1     Running   0          31d     192.168.1.10   intelnuc    <none>           <none>
kube-system   kube-flannel-ds-amd64-mn7zq                1/1     Running   0          19d     192.168.1.40   k8smysql    <none>           <none>
kube-system   kube-flannel-ds-amd64-p6lkz                1/1     Running   0          31d     192.168.1.30   k8smaster   <none>           <none>
kube-system   kube-proxy-ckfkm                           1/1     Running   0          31d     192.168.1.30   k8smaster   <none>           <none>
kube-system   kube-proxy-qhnbn                           1/1     Running   0          19d     192.168.1.40   k8smysql    <none>           <none>
kube-system   kube-proxy-rr6b8                           1/1     Running   0          31d     192.168.1.10   intelnuc    <none>           <none>
kube-system   kube-scheduler-k8smaster                   1/1     Running   3          31d     192.168.1.30   k8smaster   <none>           <none>

I've already changed the range of port of kubernetes. So I think the port 30303 and 8545 are not wrong.

I've posted this question and got an answer. But the answer is not a solution for running Geth's RPC server automatically when deploy it's pod.

Does anyone know how to solve this problem?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.