github.com/moov-io/imagecashletter@v0.10.1/docs/kubernetes.md (about)

     1  ---
     2  layout: page
     3  title: Kubernetes
     4  hide_hero: true
     5  show_sidebar: false
     6  menubar: docs-menu
     7  ---
     8  
     9  # Kubernetes
    10  
    11  The following snippet runs the ImageCashLetter Server on [Kubernetes](https://kubernetes.io/docs/tutorials/kubernetes-basics/) in the `apps` namespace. You can reach the ImageCashLetter instance at the following URL from inside the cluster.
    12  
    13  ```
    14  # Needs to be ran from inside the cluster
    15  $ curl http://imagecashletter.apps.svc.cluster.local:8083/ping
    16  PONG
    17  ```
    18  
    19  Kubernetes manifest - save in a file (`imagecashletter.yaml`) and apply with `kubectl apply -f imagecashletter.yaml`.
    20  
    21  ```yaml
    22  apiVersion: v1
    23  kind: Namespace
    24  metadata:
    25    name: apps
    26  ---
    27  apiVersion: v1
    28  kind: Service
    29  metadata:
    30    name: imagecashletter
    31    namespace: apps
    32  spec:
    33    type: ClusterIP
    34    selector:
    35      app: imagecashletter
    36    ports:
    37      - name: http
    38        protocol: TCP
    39        port: 8083
    40        targetPort: 8083
    41      - name: metrics
    42        protocol: TCP
    43        port: 9093
    44        targetPort: 9093
    45  ---
    46  apiVersion: extensions/v1beta1
    47  kind: Deployment
    48  metadata:
    49    name: imagecashletter
    50    namespace: apps
    51    labels:
    52      app: imagecashletter
    53  spec:
    54    replicas: 1
    55    selector:
    56      matchLabels:
    57        app: imagecashletter
    58    template:
    59      metadata:
    60        labels:
    61          app: imagecashletter
    62      spec:
    63        containers:
    64        - image: moov/imagecashletter:latest
    65          imagePullPolicy: Always
    66          name: imagecashletter
    67          args:
    68            - -http.addr=:8083
    69            - -admin.addr=:9093
    70          ports:
    71            - containerPort: 8083
    72              name: http
    73              protocol: TCP
    74            - containerPort: 9093
    75              name: metrics
    76              protocol: TCP
    77          resources:
    78            limits:
    79              cpu: 0.1
    80              memory: 50Mi
    81            requests:
    82              cpu: 25m
    83              memory: 10Mi
    84          readinessProbe:
    85            httpGet:
    86              path: /ping
    87              port: 8083
    88            initialDelaySeconds: 5
    89            periodSeconds: 10
    90          livenessProbe:
    91            httpGet:
    92              path: /ping
    93              port: 8083
    94            initialDelaySeconds: 5
    95            periodSeconds: 10
    96        restartPolicy: Always
    97  ```