infrapuzzle/k8s
Moritz Graf f6186e7484 First part of migrating to openebs 2020-04-24 00:03:47 +02:00
..
auth Tryout with storageos - not successful 2020-04-10 01:29:08 +02:00
cert-manager First part of migrating to openebs 2020-04-24 00:03:47 +02:00
datalab First part of migrating to openebs 2020-04-24 00:03:47 +02:00
development First part of migrating to openebs 2020-04-24 00:03:47 +02:00
kuard Commenting kuard out, as it is only for dev 2020-04-11 22:31:16 +02:00
longhorn-system Fixing unused values in loghorn 2020-04-14 14:55:41 +02:00
minio Moning awscli pod to minio namespace 2020-04-13 23:32:36 +02:00
nextcloud Adding # status: notices 2020-04-05 19:40:18 +02:00
nginx-ingress First part of migrating to openebs 2020-04-24 00:03:47 +02:00
openebs First part of migrating to openebs 2020-04-24 00:03:47 +02:00
troubleshoot Adding # status: notices 2020-04-05 19:40:18 +02:00
tt-rss Migrating tt-rss 2020-04-13 19:24:01 +02:00
web Adding secrets for registry 2020-04-10 00:45:20 +02:00
README.md First part of migrating to openebs 2020-04-24 00:03:47 +02:00

README.md

k8s

This folder holds all the services required for my private infrastructure. Following contraints apply:

  • Order of implementation is top down.
  • Every namespace has a subfolder within this subdirectory.
  • helm3

Operations

Cleanup Error pods.

kubectl get pods | grep Error | cut -d' ' -f 1 | xargs kubectl delete pod

Redeploy a deployment:

DEPLOYMENT="rstudio"
NAMESPACE="datalab"
kubectl patch deployment $DEPLOYMENT -n $NAMESPACE -p "{\"spec\": {\"template\": {\"metadata\": { \"labels\": {  \"redeploy\": \"$( date +%s )\"}}}}}"

Deployment

namespaces

namespaces="flux cert-manager nginx-ingress infrapuzzle kuard auth nextcloud datalab web development tt-rss backup monitoring"
for i in $( echo $NAMESPACES ) ; do
  k create ns $i
done

helm repositories

helm repo add stable https://kubernetes-charts.storage.googleapis.com
helm repo add jetstack https://charts.jetstack.io
helm repo update

ingress-controller

Apply with helm-operator:

helm upgrade nginx-ingress stable/nginx-ingress -n nginx-ingress -f nginx-ingress/nginx-ingress.yaml

cert-manager

Apply with helm-operator:

helm upgrade cert-manager jetstack/cert-manager -n cert-manager -f cert-manager/cert-manager.yaml
# probably not even needed:
$ kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/master/deploy/manifests/00-crds.yaml
# this is required:
$ kubectl apply -f cert-manager/staging-issuer.yaml
$ kubectl apply -f cert-manager/production-issuer.yaml

To test all this you may use the kuaard demo project:

$ kubectl apply -f kuard
# checkout: https://kuard.haumdaucher.de
$ kubectl delete -f kuard

Add private docker registry

# create secret base64 encoded and put it in htpasswd helm chart
USER='moritz'
PASSWORD='xxx'
docker run --entrypoint htpasswd --rm registry:2 -Bbn $USER $PASSWORD
# #
helm upgrade --install docker-registry stable/docker-registry -n development -f development/registry.secret.yaml
##kubectl apply -f development/registry.secret.yaml

rstudio

Currently only for one user:

kubectl apply -f datalab/rstudio.yaml

creating docker-pull-secret

Create credentials secret according to docu:

namespaces="datalab"
for i in $( echo $namespaces ) ; do
  kubectl create secret docker-registry registry-haumdaucher-de \
    -n $i \
    --docker-server=registry.haumdaucher.de \
    --docker-username=moritz \
    --docker-password='xxx' \
    --docker-email=moritz@moritzgraf.de \
    --dry-run -o yaml > ./${i}/docker-pull.yaml.secret
done
# apply
for i in $( echo $namespaces ) ; do
  kubectl apply -f ${i}/docker-pull.yaml.secret
done

tt-rss

Includes persistent data from mariadb table tt-rss.

kubectl apply -f tt-rss/

minio

kubectl apply -f minio

monitoring


auth

Including:

  • openLDAP
  • phpldapadmin
  • ldap self service
  • dex

nextcloud

Install with helm


Migate

Backup

Add mopbot & corona & corona-api

kubectl apply -f datalab/

Web

kubectl apply -f web/