Skip to content

Commit

Permalink
Document Kubernetes deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGustafsson committed Jan 3, 2025
1 parent 311601f commit 0ea59b2
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 152 deletions.
72 changes: 43 additions & 29 deletions docs/kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,53 @@
# Kubernetes
# Running Cupdate in Kubernetes

Cupdate is made to run well in Kubernetes. It is intended to be deployed as a
single node, optionally persisting its state to a persistent volume. Cupdate
will automatically react to changes to resources and update its data
accordingly.
Cupdate is made for running in Kubernetes. It is intended to be deployed as a
single instance, using the Kubernetes APIs to react on changes made to
deployments, containers, replica sets and more.

Cupdate is intended to be run using a service account.
To get started, run the command below to inspect the manifests about to be
applied.

Please refer to [`rbac.yaml`](./rbac.yaml) and [`service.yaml`](./service.yaml)
for examples on how Cupdate can be configured to run in Kubernetes.
```shell
kubectl apply --dry-run=client -o yaml 'https://github.com/AlexGustafsson/cupdate/deploy?ref=v0.13.0'
```

Next, run the following command to apply the manifests.

## Graph
```shell
kubectl apply -k 'https://github.com/AlexGustafsson/cupdate/deploy?ref=v0.13.0'
```

The diagram below shows the graphing supported by the Kubernetes Cupdate
platform.
If you're running Kubernetes with RBAC, Cupdate needs additional configuration.
To install Cupdate with support for RBAC, run the following command.

```shell
kubectl apply -k 'https://github.com/AlexGustafsson/cupdate/deploy/overlays/rbac?ref=v0.13.0'
```

```mermaid
flowchart TD
Namespace --> ResourceKindAppsV1Deployment
Namespace --> ResourceKindAppsV1DaemonSet
Namespace --> ResourceKindAppsV1ReplicaSet
Namespace --> ResourceKindAppsV1StatefulSet
Namespace --> ResourceKindBatchV1CronJob
Namespace --> ResourceKindBatchV1Job
Namespace --> ResourceKindCoreV1Pod
Namespace --> ResourceKindCoreV1Pod
## Config

ResourceKindAppsV1Deployment --> ResourceKindCoreV1Pod
ResourceKindAppsV1DaemonSet --> ResourceKindCoreV1Pod
ResourceKindAppsV1ReplicaSet --> ResourceKindCoreV1Pod
ResourceKindAppsV1StatefulSet --> ResourceKindCoreV1Pod
ResourceKindBatchV1CronJob --> ResourceKindCoreV1Pod
ResourceKindBatchV1Job --> ResourceKindCoreV1Pod
> [!NOTE]: As there are a lot of different ways to expose services, Cupdate is
> not deployed without any ingress.
ResourceKindCoreV1Pod --> ResourceKindCoreV1Container
> [!NOTE]: Without additional configuration, Cupdate is deployed without any
> persistent state. This will work, but may require additional time after
> startup for all images to be processed.
ResourceKindCoreV1Container --> Image
To more easily configure Cupdate, it's recommended to use a
`kustomization.yaml` file. You can copy [kustomization.yaml](kustomization.yaml)
and then run `kubectl apply -k kustomization.yaml` to deploy Cupdate.

For even more configurability, build the complete manifests and modify them to
your liking.

```shell
kustomize build 'https://github.com/AlexGustafsson/cupdate/deploy/overlays/rbac?ref=v0.13.0' > cupdate.yaml
```

By default, Cupdate will ignore old replica sets kept around by Kubernetes to
enable rollback of services. To include them, set
`CUPDATE_KUBERNETES_INCLUDE_OLD_REPLICAS` to `true`.

Whilst the commands above are enough to get you started with Cupdate, you might
want to change some configuration to better suite your needs. Please see the
additional documentation in [../config.md](../config.md).
37 changes: 37 additions & 0 deletions docs/kubernetes/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: cupdate

resources:
# NOTE: Update the ref to the tag you want to deploy
# NOTE: The double slash (//) is required by kustomize
- https://github.com/AlexGustafsson/cupdate//deploy/overlays/rbac?timeout=120&ref=v0.13.0
# Here's a good place to reference a file containing ingress manifests
# - ingress.yaml
#
# Uncomment these lines to modify Cupdate's config
# configMapGenerator:
# - name: cupdate-config
# behavior: merge
# literals:
# - CUPDATE_LOG_LEVEL=debug
# - CUPDATE_OTEL_INSECURE=true
# - CUPDATE_OTEL_TARGET=tempo.monitoring.svc.cluster.local:4317
# - CUPDATE_PROCESSING_MIN_AGE=12h
#
# Uncomment these lines to configure a persistent volume for Cupdate
# patches:
# - patch: |-
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: cupdate
# spec:
# template:
# spec:
# volumes:
# - name: data
# hostPath:
# # By default owned by 2000:2000
# path: /path/to/cupdate/data
50 changes: 0 additions & 50 deletions docs/kubernetes/rbac.yaml

This file was deleted.

73 changes: 0 additions & 73 deletions docs/kubernetes/service.yaml

This file was deleted.

0 comments on commit 0ea59b2

Please sign in to comment.