github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/contrib/config/kubernetes/dgraph-single/dgraph-single.yaml (about)

     1  # This is the service that should be used by the clients of Dgraph to talk to the cluster.
     2  apiVersion: v1
     3  kind: Service
     4  metadata:
     5    name: dgraph-public
     6    labels:
     7      app: dgraph
     8  spec:
     9    type: LoadBalancer
    10    ports:
    11    - port: 5080
    12      targetPort: 5080
    13      name: zero-grpc
    14    - port: 6080
    15      targetPort: 6080
    16      name: zero-http
    17    - port: 8080
    18      targetPort: 8080
    19      name: alpha-http
    20    - port: 9080
    21      targetPort: 9080
    22      name: alpha-grpc
    23    - port: 8000
    24      targetPort: 8000
    25      name: ratel-http
    26    selector:
    27      app: dgraph
    28  ---
    29  # This StatefulSet runs 1 pod with one Zero, one Alpha & one Ratel containers.
    30  apiVersion: apps/v1
    31  kind: StatefulSet
    32  metadata:
    33    name: dgraph
    34  spec:
    35    serviceName: "dgraph"
    36    replicas: 1
    37    selector:
    38        matchLabels:
    39          app: dgraph
    40    template:
    41      metadata:
    42        labels:
    43          app: dgraph
    44      spec:
    45        containers:
    46        - name: ratel
    47          image: dgraph/dgraph:latest
    48          imagePullPolicy: IfNotPresent
    49          ports:
    50          - containerPort: 8000
    51            name: ratel-http
    52          command:
    53            - dgraph-ratel
    54        - name: zero
    55          image: dgraph/dgraph:latest
    56          imagePullPolicy: IfNotPresent
    57          ports:
    58          - containerPort: 5080
    59            name: zero-grpc
    60          - containerPort: 6080
    61            name: zero-http
    62          volumeMounts:
    63          - name: datadir
    64            mountPath: /dgraph
    65          command:
    66            - bash
    67            - "-c"
    68            - |
    69              set -ex
    70              dgraph zero --my=$(hostname -f):5080
    71        - name: alpha
    72          image: dgraph/dgraph:latest
    73          imagePullPolicy: IfNotPresent
    74          ports:
    75          - containerPort: 8080
    76            name: alpha-http
    77          - containerPort: 9080
    78            name: alpha-grpc
    79          volumeMounts:
    80          - name: datadir
    81            mountPath: /dgraph
    82          env:
    83            - name: POD_NAMESPACE
    84              valueFrom:
    85                fieldRef:
    86                  fieldPath: metadata.namespace
    87          command:
    88            - bash
    89            - "-c"
    90            - |
    91              set -ex
    92              dgraph alpha --my=$(hostname -f):7080 --lru_mb 2048 --zero dgraph-0.dgraph.${POD_NAMESPACE}.svc.cluster.local:5080
    93        terminationGracePeriodSeconds: 60
    94        volumes:
    95        - name: datadir
    96          persistentVolumeClaim:
    97            claimName: datadir
    98    updateStrategy:
    99      type: RollingUpdate
   100    volumeClaimTemplates:
   101    - metadata:
   102        name: datadir
   103        annotations:
   104          volume.alpha.kubernetes.io/storage-class: anything
   105      spec:
   106        accessModes:
   107          - "ReadWriteOnce"
   108        resources:
   109          requests:
   110            storage: 5Gi