apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: beacon-chain
  namespace: ethereum-2
  labels:
    app.kubernetes.io/name: beacon-chain
    app.kubernetes.io/version: v1.0.0-beta.2
spec:
  serviceName: beacon-chain
  selector:
    matchLabels:
      app.kubernetes.io/name: beacon-chain
  template:
    metadata:
      labels:
        app.kubernetes.io/name: beacon-chain
        app.kubernetes.io/version: v1.0.0-beta.2
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/port: '8080'
    spec:
      serviceAccountName: beacon-chain
      containers:
      - name: beacon-chain
        image: gcr.io/prysmaticlabs/prysm/beacon-chain:v1.0.0-beta.2
        args:
        - --medalla
        - --accept-terms-of-use
        - --datadir=/var/lib/beacon-chain
        - --p2p-host-dns=ethereum-2.allyoucanstake.com
        - --p2p-tcp-port=31300
        - --p2p-udp-port=31200
        - --rpc-host=$(POD_IP)
        - --tls-key=/etc/tls/tls.key
        - --tls-cert=/etc/tls/tls.crt
        - --monitoring-host=$(POD_IP)
        - --disable-grpc-gateway # to avoid /healthz reporting unhealthy
        - --enable-tracing
        - --tracing-endpoint=http://jaeger-collector:14268/api/traces
        env:
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        ports:
        - name: rpc
          containerPort: 4000
        - name: metrics
          containerPort: 8080
        - name: p2p
          containerPort: 31300
        - name: discv5
          containerPort: 31200
          protocol: UDP
        resources:
          requests:
            cpu: 250m
            memory: 1Gi
          limits:
            cpu: 500m
            memory: 2Gi
        volumeMounts:
        - mountPath: /etc/tls
          name: tls
          readOnly: true
        - mountPath: /var/lib/beacon-chain
          name: data
        readinessProbe:
          httpGet:
            path: /healthz
            port: metrics
          failureThreshold: 5
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 30
        livenessProbe:
          httpGet:
            path: /healthz
            port: metrics
          failureThreshold: 5
          initialDelaySeconds: 600
          periodSeconds: 60
          successThreshold: 1
          timeoutSeconds: 30
        securityContext:
          runAsNonRoot: true
          runAsUser: 65534
          readOnlyRootFilesystem: true
          capabilities:
            drop: ["ALL"]
      securityContext:
        fsGroup: 65534
      terminationGracePeriodSeconds: 300
      volumes:
      - name: tls
        secret:
          secretName: beacon-chain-tls
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      storageClassName: standard-rwo
      accessModes:
      - ReadWriteOnce
      volumeMode: Filesystem
      resources:
        requests:
          storage: 20Gi
