course_deploying_an_applica.../module3/README.md

91 lines
3.2 KiB
Markdown

# Scrumlr K8s Deployment
## Generate JWT Key
```bash
openssl ecparam -genkey -name secp521r1 -noout -out $(git rev-parse --show-toplevel)/module3/k8s/kustomize/scrumlr/jwt.key
```
## Differences in deployment between local minikube cluster and SKE cluster
* Skip PostgreSQL Deployment for SKE deployment, since we use external PostgreSQL
* Set the right `SCRUMLR_SERVER_DATABASE_URL` value in the scrumlr-backend secret
* Minikube: Ingress without Host and external-dns/ cert-manager annotations
* SKE: Ingress with Host and external-dns/ cert-manager annotations
## Deploy Scrumlr into local cluster using minikube
Local Deployment that can run on a lokal K8s cluster like a [minikube](https://minikube.sigs.k8s.io/docs/) cluster.
As we don't have Postgres as an external service here, we also install Postgres directly in our local cluster.
```sh
cd $(git rev-parse --show-toplevel)/module3/k8s/
# Create Cluster with kind and start cloud-provider-kind for Ingress
minikube start
minikube tunnel
# Install ingress-nginx and nats with helm
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo add nats https://nats-io.github.io/k8s/helm/charts/
helm repo update
helm upgrade \
ingress-nginx ingress-nginx/ingress-nginx \
--install \
--namespace ingress-nginx \
--create-namespace \
--version 4.12.1 \
--values helm/ingress-nginx/values.yaml
helm upgrade \
--install \
nats nats/nats \
--namespace nats \
--create-namespace \
--version 1.3.3 \
--values helm/nats/values.yaml
# Install kustomize applications
kubectl apply -k kustomize/postgres
kubectl apply -k kustomize/scrumlr
# Use external IP of your Ingress Controller in your Browser to open Scrumlr
kubectl get services --namespace ingress-nginx ingress-nginx-controller --output jsonpath='{.status.loadBalancer.ingress[0].ip}'
# Destroy Cluster
minikube stop
minikube delete
```
```shell
# Optional: Connect to your PostgreSQL instance with psql (psql must be installed)
kubectl port-forward -n postgres services/postgres-scrumlr
psql -h localhost -U scrumlr -d scrumlr
# List all tables
scrumlr-# \dt
List of relations
Schema | Name | Type | Owner
--------+------------------------+-------+---------
public | apple_users | table | scrumlr
public | azure_ad_users | table | scrumlr
public | board_session_requests | table | scrumlr
public | board_sessions | table | scrumlr
public | board_templates | table | scrumlr
public | boards | table | scrumlr
public | column_templates | table | scrumlr
public | columns | table | scrumlr
public | deleted_boards | table | scrumlr
public | github_users | table | scrumlr
public | google_users | table | scrumlr
public | microsoft_users | table | scrumlr
public | notes | table | scrumlr
public | oidc_users | table | scrumlr
public | reactions | table | scrumlr
public | schema_migrations | table | scrumlr
public | users | table | scrumlr
public | votes | table | scrumlr
public | votings | table | scrumlr
(19 rows)
```