From 3501d5a9ed789f022a4f77df7ec8d537e5d3a6a1 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Wed, 14 Apr 2021 16:44:15 -0400 Subject: [PATCH] feat: install homer app --- README.md | 60 ++++++++++++++++++- cluster/apps/default/homer/config-pvc.yaml | 12 ++++ cluster/apps/default/homer/helm-release.yaml | 40 +++++++++++++ cluster/apps/default/homer/kustomization.yaml | 5 ++ cluster/apps/default/kustomization.yaml | 4 ++ cluster/apps/kustomization.yaml | 1 + 6 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 cluster/apps/default/homer/config-pvc.yaml create mode 100644 cluster/apps/default/homer/helm-release.yaml create mode 100644 cluster/apps/default/homer/kustomization.yaml create mode 100644 cluster/apps/default/kustomization.yaml diff --git a/README.md b/README.md index 0c5171c4..1a658089 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ The components installed by default are listed below and can be replaced to your - [metallb](https://metallb.universe.tf/) - [cert-manager](https://cert-manager.io/) with Cloudflare DNS challenge - [ingress-nginx](https://kubernetes.github.io/ingress-nginx/) +- [homer](https://github.com/bastienwirtz/homer) ## :memo:  Prerequisites @@ -198,6 +199,16 @@ kubectl --kubeconfig=./kubeconfig --kustomize=./cluster/base/flux-system ## Post installation +### Verify ingress + +If your cluster is not accessible to outside world you can update your hosts file to verify the ingress controller is working. + +```sh +sudo echo "${BOOTSTRAP_INGRESS_NGINX_LB} ${BOOTSTRAP_DOMAIN} homer.${BOOTSTRAP_DOMAIN}" >> /etc/hosts +``` + +Head over to your browser and you _should_ be able to access `https://homer.${BOOTSTRAP_DOMAIN}` + ### pre-commit It is advisable to install [pre-commit](https://pre-commit.com/) and the pre-commit hooks that come with this repository. @@ -209,9 +220,56 @@ After pre-commit is installed run: pre-commit install-hooks ``` +### direnv + +This is a great tool to export environment variables depending on what your present working directory is, head over to their [installation guide](https://direnv.net/docs/installation.html) and don't forget to hook it into your shell! + +## Debugging + +Show the health of you kustomizations + +```sh +kubectl --kubeconfig=./kubeconfig get kustomization -A +# NAMESPACE NAME READY STATUS AGE +# flux-system apps True Applied revision: main/943e4126e74b273ff603aedab89beb7e36be4998 3d19h +# flux-system core True Applied revision: main/943e4126e74b273ff603aedab89beb7e36be4998 4d6h +# flux-system flux-system True Applied revision: main/943e4126e74b273ff603aedab89beb7e36be4998 4d6h +``` + +Show the health of your main Flux `GitRepository` + +```sh +flux get sources git +# NAME READY MESSAGE REVISION SUSPENDED +# flux-system True Fetched revision: main/943e4126e74b273ff603aedab89beb7e36be4998 main/943e4126e74b273ff603aedab89beb7e36be4998 False +``` + +Show the health of your `HelmRelease`s + +```sh +flux get helmrelease -A +# NAMESPACE NAME READY MESSAGE REVISION SUSPENDED +# cert-manager cert-manager True Release reconciliation succeeded v1.3.0 False +# home homer True Release reconciliation succeeded 4.2.0 False +# networking ingress-nginx True Release reconciliation succeeded 3.29.0 False +``` + +Show the health of your `HelmRepository`s + +```sh +flux get sources helm -A +# NAMESPACE NAME READY MESSAGE REVISION SUSPENDED +# flux-system bitnami-charts True Fetched revision: 0ec3a3335ff991c45735866feb1c0830c4ed85cf 0ec3a3335ff991c45735866feb1c0830c4ed85cf False +# flux-system ingress-nginx-charts True Fetched revision: 45669a3117fc93acc09a00e9fb9b4445e8990722 45669a3117fc93acc09a00e9fb9b4445e8990722 False +# flux-system jetstack-charts True Fetched revision: 7bad937cc82a012c9ee7d7a472d7bd66b48dc471 7bad937cc82a012c9ee7d7a472d7bd66b48dc471 False +# flux-system k8s-at-home-charts True Fetched revision: 1b24af9c5a1e3da91618d597f58f46a57c70dc13 1b24af9c5a1e3da91618d597f58f46a57c70dc13 False +``` + +Flux has a wide range of CLI options available be sure to run `flux --help` to view more! + ## What's next? -The world is your pod, try installing a application! +The world is your cluster, try installing another application! ## :handshake:  Thanks diff --git a/cluster/apps/default/homer/config-pvc.yaml b/cluster/apps/default/homer/config-pvc.yaml new file mode 100644 index 00000000..90321318 --- /dev/null +++ b/cluster/apps/default/homer/config-pvc.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: homer-config +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-path + resources: + requests: + storage: 128Mi diff --git a/cluster/apps/default/homer/helm-release.yaml b/cluster/apps/default/homer/helm-release.yaml new file mode 100644 index 00000000..62a527f4 --- /dev/null +++ b/cluster/apps/default/homer/helm-release.yaml @@ -0,0 +1,40 @@ +--- +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: homer + namespace: default +spec: + interval: 5m + chart: + spec: + # renovate: registryUrl=https://kubernetes.github.io/homer + chart: homer + version: 4.2.0 + sourceRef: + kind: HelmRepository + name: k8s-at-home-charts + namespace: flux-system + interval: 5m + values: + image: + repository: b4bz/homer + tag: 21.03.2 + pullPolicy: IfNotPresent + ingress: + enabled: true + annotations: + kubernetes.io/ingress.class: "nginx" + hosts: + - host: "homer.${SECRET_DOMAIN}" + paths: + - path: / + pathType: Prefix + tls: + - hosts: + - "homer.${SECRET_DOMAIN}" + persistence: + config: + enabled: true + existingClaim: homer-config + mountPath: /www/assets \ No newline at end of file diff --git a/cluster/apps/default/homer/kustomization.yaml b/cluster/apps/default/homer/kustomization.yaml new file mode 100644 index 00000000..97b3a7ee --- /dev/null +++ b/cluster/apps/default/homer/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- config-pvc.yaml +- helm-release.yaml diff --git a/cluster/apps/default/kustomization.yaml b/cluster/apps/default/kustomization.yaml new file mode 100644 index 00000000..4c95e6b9 --- /dev/null +++ b/cluster/apps/default/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- homer diff --git a/cluster/apps/kustomization.yaml b/cluster/apps/kustomization.yaml index 997c4ed9..27c56547 100644 --- a/cluster/apps/kustomization.yaml +++ b/cluster/apps/kustomization.yaml @@ -1,4 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: +- default - networking