https://github.com/nallenscott/titan
Sandbox for deploying Prometheus, Thanos, and Grafana to K8s with ArgoCD.
https://github.com/nallenscott/titan
argocd braids grafana helm k8s kind kubectl kubernetes prometheus thanos
Last synced: 15 days ago
JSON representation
Sandbox for deploying Prometheus, Thanos, and Grafana to K8s with ArgoCD.
- Host: GitHub
- URL: https://github.com/nallenscott/titan
- Owner: nallenscott
- Created: 2022-12-31T12:00:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-15T14:06:50.000Z (over 2 years ago)
- Last Synced: 2025-02-17T16:52:28.476Z (3 months ago)
- Topics: argocd, braids, grafana, helm, k8s, kind, kubectl, kubernetes, prometheus, thanos
- Language: Shell
- Homepage:
- Size: 152 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
titan
> **Table of Contents**
> * [Introduction](#introduction)
> * [Prerequisites](#prerequisites)
> * [Getting started](#getting-started)
> * [Delivery cluster](#delivery-cluster)
> * [Repository access](#repository-access)
> * [Accessing the UIs](#accessing-the-uis)
> * [Custom resources](#custom-resources)
> * [Using the CLI](#using-the-cli)## Introduction
Titan is a sandbox for deploying [Prometheus](https://prometheus.io), [Thanos](https://thanos.io), and [Grafana](https://grafana.com) to K8s with [ArgoCD](https://argoproj.github.io/cd/).
## Prerequisites
Titan assumes you're running on a Mac, and have the following installed. If you don't have them, you can install them with [Homebrew](https://brew.sh/):
| Service | Installation |
| --- | --- |
| [Docker](https://www.docker.com/) | `brew install docker` |
| [Kind](https://kind.sigs.k8s.io/) | `brew install kind` |
| [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) | `brew install kubectl` |
| [Helm](https://helm.sh/) | `brew install helm` |
| [ArgoCD](https://argoproj.github.io/argo-cd/getting_started/) | `brew install argocd` |## Getting started
1. Create a fork of this repo, and clone it to your local machine.
2. Open a terminal on the cloned directory and run `./titan init`.
3. When you're done, run `./titan kill` to tear down the clusters.Titan will create local Kind clusters for management and delivery, and deploy ArgoCD to the management cluster. It will also deploy Prometheus, Thanos, and Grafana to the delivery cluster.
### Delivery cluster
ArgoCD needs access to the delivery cluster, so it can deploy the applications. To do this, titan uses a kind [config file](https://kind.sigs.k8s.io/docs/user/configuration/) to create a cluster with an `apiServerAddress` set to the host machine's IP address.
As an added convenience, the build script will attempt to detect your IP address, using the `en0` and `en1` interfaces, and update the config for you. If it can't detect your IP address, you can set it manually in the `delivery/cluster.yaml` file.
### Repository access
ArgoCD needs access to the repo. GitOps works by pulling the manifests from a git repository, and applying them to the cluster. If you're happy with the manifests in this repo, you can leave them as-is. If you want to make changes, you'll need to fork the repo, and edit the manifests to point to your fork (use `https`, not `ssh`):
| File | Field |
| --- | --- |
| management/manifests/application.yaml | `repoURL` |
| management/manifests/repository.yaml | `url` |
| delivery/manifests/shared.yaml | `repoURL` |### Accessing the UIs
Once the clusters are up, you can access the UIs. You'll need to forward the ports for each service. First, set the context for the cluster you want to access:
```bash
$ kubectl config use-context kind-{delivery|management}
```Then, forward the ports (in separate terminals):
```bash
$ kubectl port-forward svc/{service} -n {namespace} {ports}
```List of values to pass into `kubectl port-forward`:
| Service | Namespace | Ports |
| --- | --- | --- |
| argocd-server | argocd | `8080:443` |
| grafana | monitoring | `3000:3000` |
| prometheus | monitoring | `9090:9090` |
| thanos-query | monitoring | `9090:9090` |### Custom resources
Helm doesn't support upgrading CRDs in the default `/crds` directory, so titan uses [braid](https://github.com/cristibalan/braid) to manage the CRDs for ArgoCD and Prometheus externally. To update the CRDs, run the following:
```bash
$ braid update # and commit the changes
$ kubectl config use-context kind-{management|delivery}
$ kubectl apply -f {management|delivery}/shared/crds
```## Using the CLI
Titan provides a cli to help you raise and lower the stack. It's a simple wrapper around `kind`, `kubectl`, and `helm`, so you can use those tools directly if you prefer.
| Command | Description |
| --- | --- |
| `./titan init` | Create clusters and deploy apps. |
| `./titan kill` | Tear down clusters. |
| `./titan help` | Print help text. |