Skip to content

Commit

Permalink
Merge pull request #3 from KumKeeHyun/helm
Browse files Browse the repository at this point in the history
Helm
  • Loading branch information
KumKeeHyun authored Aug 18, 2023
2 parents 8fdef92 + 655d2f5 commit 66f64f2
Show file tree
Hide file tree
Showing 24 changed files with 325 additions and 6 deletions.
83 changes: 83 additions & 0 deletions install/etc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Infra Settings

## MetalLB

### Install with Helm

```shell
$ helm repo add metallb https://metallb.github.io/metallb
"metallb" has been added to your repositories

$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "metallb" chart repository
Update Complete. ⎈Happy Helming!

$ helm repo list
NAME URL
metallb https://metallb.github.io/metallb

$ helm install metallb metallb/metallb --create-namespace -n metallb-system
NAME: metallb
LAST DEPLOYED: Thu Aug 17 17:23:25 2023
NAMESPACE: metallb-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
MetalLB is now running in the cluster.

Now you can configure it via its CRs. Please refer to the metallb official docs
on how to use the CRs.

$ kubectl apply -f metallb-configs.yaml
ipaddresspool.metallb.io/address-pool created
l2advertisement.metallb.io/layer2 created
```
## ArgoCD
### Install with Manifest
```shell
$ kubectl create namespace argocd
$ kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
customresourcedefinition.apiextensions.k8s.io/applications.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/applicationsets.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/appprojects.argoproj.io created
serviceaccount/argocd-application-controller created
serviceaccount/argocd-applicationset-controller created
serviceaccount/argocd-dex-server created
serviceaccount/argocd-notifications-controller created
serviceaccount/argocd-redis created
...

# option
$ kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

# get admin password
$ kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

# delete all resources
$ kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
```
## Traefik
### Install with Helm
```shell
$ helm repo add traefik https://traefik.github.io/charts
"traefik" has been added to your repositories

$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "traefik" chart repository
Update Complete. ⎈Happy Helming!

$ helm repo list
NAME URL
traefik https://traefik.github.io/chart

$ helm install traefik traefik/traefik --create-namespace -n traefik
```
17 changes: 17 additions & 0 deletions install/etc/metallb-configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: address-pool
namespace: metallb-system
spec:
addresses:
- 127.0.0.240/28
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: layer2
namespace: metallb-system
spec:
ipAddressPools:
- address-pool
6 changes: 6 additions & 0 deletions install/ingress-helm/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: traefik
repository: https://helm.traefik.io/traefik
version: 24.0.0
digest: sha256:9dcd24238364a78ff6303c4ccaf2c6f13ea1d8cc5f7ba3fada4c82a796153a5b
generated: "2023-08-18T00:16:25.936848+09:00"
10 changes: 10 additions & 0 deletions install/ingress-helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: traefik-ingress-charts
version: 0.0.1
sources:
- https://github.com/KumKeeHyun/go-gin-realworld-example-app
dependencies:
- name: traefik
repository: https://helm.traefik.io/traefik
version: 24.0.0
condition: traefik.enabled
Binary file added install/ingress-helm/charts/traefik-24.0.0.tgz
Binary file not shown.
22 changes: 22 additions & 0 deletions install/ingress-helm/templates/argocd-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: argocd
namespace: argocd
spec:
entryPoints:
- websecure
routes:
- match: Host(`argocd.{{ .Values.adminConfig.DOMAIN_NAME }}`)
kind: Rule
priority: 10
services:
- name: argocd-server
port: 443
- match: Host(`argocd.{{ .Values.adminConfig.DOMAIN_NAME }}`) && Headers(`Content-Type`, `application/grpc`)
kind: Rule
priority: 11
services:
- name: argocd-server
port: 443
scheme: h2c
14 changes: 14 additions & 0 deletions install/ingress-helm/templates/grafana-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: grafana
namespace: observability
spec:
entryPoints:
- websecure
routes:
- match: Host(`grafana.{{ .Values.adminConfig.DOMAIN_NAME }}`)
kind: Rule
services:
- name: observability-grafana
port: 80
14 changes: 14 additions & 0 deletions install/ingress-helm/templates/prometheus-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: prometheus
namespace: observability
spec:
entryPoints:
- websecure
routes:
- match: Host(`prometheus.{{ .Values.adminConfig.DOMAIN_NAME }}`)
kind: Rule
services:
- name: prometheus-operated
port: 9090
4 changes: 4 additions & 0 deletions install/ingress-helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
traefik:
enabled: true
adminConfig:
DOMAIN_NAME: localhost
6 changes: 6 additions & 0 deletions install/observability-helm/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: kube-prometheus-stack
repository: https://prometheus-community.github.io/helm-charts
version: 48.3.1
digest: sha256:c5571cb1b6dded53f89e757d1d7039c6a98ea4d9b7d9d0c6604a1af4e42c45a4
generated: "2023-08-18T00:15:03.926057+09:00"
10 changes: 10 additions & 0 deletions install/observability-helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: observability-charts
version: 0.0.1
sources:
- https://github.com/KumKeeHyun/go-gin-realworld-example-app
dependencies:
- name: kube-prometheus-stack
repository: https://prometheus-community.github.io/helm-charts
version: 48.3.1
condition: kube-prometheus-stack.enabled
Binary file not shown.
43 changes: 43 additions & 0 deletions install/observability-helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
kube-prometheus-stack:
enabled: true
defaultRules:
create: false
alertmanager:
enabled: true
grafana:
enabled: true
kubeApiServer:
enabled: false
kubelet:
enabled: false
kubeControllerManager:
enabled: false
coreDns:
enabled: false
kubeDns:
enabled: false
kubeEtcd:
enabled: false
kubeScheduler:
enabled: false
kubeProxy:
enabled: false
kubeStateMetrics:
enabled: false
nodeExporter:
enabled: false
prometheusOperator:
enabled: true
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 1
memory: 1Gi
serviceMonitor:
selfMonitor: false
prometheus:
enabled: true
prometheusSpec:
retention: 1d
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: restapp-charts
name: realworld-charts
version: 0.0.1
sources:
- https://github.com/KumKeeHyun/go-gin-realworld-example-app
Expand Down
23 changes: 23 additions & 0 deletions install/realworld-helm/templates/frontend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-realworld-frontend
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Release.Name }}-realworld-frontend
spec:
replicas: {{ .Values.frontend.replicas }}
selector:
matchLabels:
app: {{ .Release.Name }}-realworld-frontend
template:
metadata:
labels:
app: {{ .Release.Name }}-realworld-frontend
spec:
containers:
- name: realworld-frontend
image: kbzjung359/realworld-frontend:realworld-localhost
imagePullPolicy: Always
resources:
{{- toYaml .Values.frontend.resources | nindent 12 }}
15 changes: 15 additions & 0 deletions install/realworld-helm/templates/frontend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-realworld-frontend
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Release.Name }}-realworld-frontend
spec:
selector:
app: {{ .Release.Name }}-realworld-frontend
ports:
- name: http
port: {{ .Values.frontend.service.port }}
targetPort: 8080
type: {{ .Values.frontend.service.type }}
19 changes: 19 additions & 0 deletions install/realworld-helm/templates/realworld-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: {{ .Release.Name }}
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`realworld.{{ .Values.adminConfig.DOMAIN_NAME }}`) && PathPrefix(`/`)
kind: Rule
services:
- name: {{ .Release.Name }}-realworld-frontend
port: {{ .Values.frontend.service.port }}
- match: Host(`realworld.{{ .Values.adminConfig.DOMAIN_NAME }}`) && PathPrefix(`/api`)
kind: Rule
services:
- name: {{ .Release.Name }}-realworld-restapp
port: {{ .Values.restapp.service.port }}
15 changes: 15 additions & 0 deletions install/realworld-helm/templates/realworld-servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Release.Name }}-realworld-restapp
labels:
app: {{ .Release.Name }}-realworld-restapp
release: observability
namespace: default
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-realworld-restapp
endpoints:
- port: "http"
path: /metrics
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ kind: Service
metadata:
name: {{ .Release.Name }}-realworld-restapp
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Release.Name }}-realworld-restapp
spec:
selector:
app: {{ .Release.Name }}-realworld-restapp
ports:
- name: http-server
- name: http
port: {{ .Values.restapp.service.port }}
targetPort: {{ .Values.restapp.service.targetPort }}
type: {{ .Values.restapp.service.type }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
adminConfig:
DOMAIN_NAME: localhost
JWTSecret: "realworld"
POSTGRES_DB_SERVER: "postgresql"
POSTGRES_DB_PORT: "5432"
Expand All @@ -14,16 +15,16 @@ postgresql:
restapp:
image:
repository: kbzjung359/realworld
tag: sha-0802875
tag: sha-8fdef92
pullPolicy: "Always"
ports:
- name: http
containerPort: 8080
service:
type: LoadBalancer
port: 10080
type: ClusterIP
port: 9080
targetPort: 8080
replicas: 1
replicas: 4
resources:
requests:
memory: "150Mi"
Expand All @@ -33,3 +34,18 @@ restapp:
memory: "150Mi"
cpu: "120m"
ephemeral-storage: "100Mi"

frontend:
service:
type: ClusterIP
port: 9100
replicas: 1
resources:
requests:
memory: "150Mi"
cpu: "125m"
ephemeral-storage: "100Mi"
limits:
memory: "150Mi"
cpu: "125m"
ephemeral-storage: "100Mi"

0 comments on commit 66f64f2

Please sign in to comment.