Ajout pod heimdall-node

deployement

La commande docker avec le filesystem preparé

docker run -d \
  --name=heimdall \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/London \
  -p 80:80 \
  -p 443:443 \
  -v </path/to/appdata/config>:/config \
  --restart unless-stopped \
  lscr.io/linuxserver/heimdall

traduction en kubernetes deploy :

apiVersion: apps/v1
kind: Deployment
metadata:
  name: heimdallserver 
  namespace: default
  labels:
    app: heimdall
spec:
  replicas: 1
  selector:
    matchLabels:
      app: heimdall
  template:
    metadata:
      labels:
        run: heimdallserver 
        app: heimdall
    spec:
      containers:
      - name: heimdallserver 
        image: lscr.io/linuxserver/heimdall
        env:
          - name: "UID"
            value: "1000"
          - name: "GID"
            value: "100"  
        ports:
        - containerPort: 80
          name: heimdall-http
        - containerPort: 443
          name: heimdall-https
        volumeMounts:
        - mountPath: /config
          name: heimdall-config
      volumes:
      - name: heimdall-config
        hostPath:
          type: DirectoryOrCreate
          path: /usr/kubedata/heimdallserver/config
---
apiVersion: v1
kind: Service
metadata:
  name: heimdall-svc
spec:
  selector:
    app: heimdall
  ports:
    - name: http
      port: 80
      targetPort: 80
      nodePort: 32501
    - name: https
      port: 443
      targetPort: 443
  type: NodePort

puis on recupere le port d’exposition

kubectl get all --all-namespaces | grep heimdall

resultat le dashboard est accecible https://<master-ip>:32501

installation des images Docker

Docker Logos | Docker

install emby

microk8s kubectl create deployment embyserver --image=emby/embyserver:latest
microk8s kubectl expose deployment embyserver --type=NodePort --port=8096
microk8s kubectl port-forward -n default service/embyserver 8096:8096 --address 192.168.1.26 &

install sickchill

microk8s kubectl create deployment sickchill --image=sickchill/sickchill
microk8s kubectl expose deployment sickchill --type=NodePort --port=8081

microk8s kubectl port-forward -n default service/sickchill 8081:8081 --address 192.168.1.26 &

install transmission

microk8s kubectl create deployment transmission --image=linuxserver/transmission
microk8s kubectl expose deployment transmission --type=NodePort --port=9091
microk8s kubectl port-forward -n default service/transmission 9091:9091 --address 192.168.1.26 &

edit file /config/settings.json

Ubuntu , Docker, Kubernetes

Installer ubuntu sur proxmox

Installer Docker

curl https://releases.rancher.com/install-docker/20.10.sh | sh

Update Ubuntu

Afin deviter des erreur pendant l’install il faut mettre a jour ubuntu avant de lancer la procedure d’install

sudo apt update
sudo apt upgrade
sudo reboot

Installer Kubernetes

https://ubuntu.com/tutorials/install-a-local-kubernetes-with-microk8s#2-deploying-microk8s

sudo snap install microk8s --classic
sudo ufw allow in on cni0 && sudo ufw allow out on cni0
sudo ufw default allow routed
microk8s enable dns dashboard storage
microk8s kubectl get all --all-namespaces
microk8s kubectl port-forward -n  kube-system service/kubernetes-dashboard 10443:443 --address 0.0.0.0 &&

creation d’un alias pour lancer les commandes “microk8s kubectl” directement avec ” kubectl”

sudo snap alias microk8s.kubectl kubectl
david@legion2:~$ microk8s kubectl get all --all-namespaces
NAMESPACE     NAME                                             READY   STATUS    RESTARTS       AGE
kube-system   pod/coredns-7f9c69c78c-7ljk2                     1/1     Running   1 (6h2m ago)   6h36m
kube-system   pod/calico-kube-controllers-6b654d96bd-ngxnq     1/1     Running   1 (6h2m ago)   14h
kube-system   pod/calico-node-tb2cz                            1/1     Running   1 (6h2m ago)   14h
kube-system   pod/metrics-server-85df567dd8-gfjvk              1/1     Running   0              5h57m
kube-system   pod/kubernetes-dashboard-59699458b-66gng         1/1     Running   0              5h53m
kube-system   pod/dashboard-metrics-scraper-58d4977855-lg8qw   1/1     Running   0              5h53m
kube-system   pod/hostpath-provisioner-5c65fbdb4f-nvclh        1/1     Running   0              5h53m
default       pod/embyserver-56d8c5b5bc-4xtj9                  1/1     Running   0              13m

NAMESPACE     NAME                                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
default       service/kubernetes                  ClusterIP   10.152.183.1     <none>        443/TCP                  14h
kube-system   service/kube-dns                    ClusterIP   10.152.183.10    <none>        53/UDP,53/TCP,9153/TCP   6h36m
kube-system   service/metrics-server              ClusterIP   10.152.183.220   <none>        443/TCP                  5h57m
kube-system   service/kubernetes-dashboard        ClusterIP   10.152.183.11    <none>        443/TCP                  5h54m
kube-system   service/dashboard-metrics-scraper   ClusterIP   10.152.183.66    <none>        8000/TCP                 5h54m
default       service/embyserver                  NodePort    10.152.183.74    <none>        8096:30829/TCP           9m48s

NAMESPACE     NAME                         DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
kube-system   daemonset.apps/calico-node   1         1         1       1            1           kubernetes.io/os=linux   14h

NAMESPACE     NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE
kube-system   deployment.apps/coredns                     1/1     1            1           6h36m
kube-system   deployment.apps/calico-kube-controllers     1/1     1            1           14h
kube-system   deployment.apps/metrics-server              1/1     1            1           5h57m
kube-system   deployment.apps/kubernetes-dashboard        1/1     1            1           5h54m
kube-system   deployment.apps/dashboard-metrics-scraper   1/1     1            1           5h54m
kube-system   deployment.apps/hostpath-provisioner        1/1     1            1           5h54m
default       deployment.apps/embyserver                  1/1     1            1           13m

NAMESPACE     NAME                                                   DESIRED   CURRENT   READY   AGE
kube-system   replicaset.apps/calico-kube-controllers-69d7f794d9     0         0         0       14h
kube-system   replicaset.apps/coredns-7f9c69c78c                     1         1         1       6h36m
kube-system   replicaset.apps/calico-kube-controllers-6b654d96bd     1         1         1       14h
kube-system   replicaset.apps/metrics-server-85df567dd8              1         1         1       5h57m
kube-system   replicaset.apps/kubernetes-dashboard-59699458b         1         1         1       5h53m
kube-system   replicaset.apps/dashboard-metrics-scraper-58d4977855   1         1         1       5h53m
kube-system   replicaset.apps/hostpath-provisioner-5c65fbdb4f        1         1         1       5h53m
default       replicaset.apps/embyserver-56d8c5b5bc                  1         1         1       13m

Ubuntu , Docker, Rancher, Kubernetes

Installer ubuntu sur proxmox

Installer Docker

curl https://releases.rancher.com/install-docker/20.10.sh | sh

Installer Rancher

la commande d’installation fait que /opt/rancher est l’emplacement persistant de la configuration du node docker , ce qui permet d’assigner un disk vm pour conserver la config rancher meme si on detruit le contener docker

ajouter un disk a la vm

dans ubuntu le partitionner , formater et le monter

sudo mkdir /opt/rancher

sudo parted /dev/sdb

sudo mkfs -t ext4 /dev/sdb1

sudo nano -Bw /etc/fstab
/dev/sdb1    /opt/rancher   ext4    defaults     0        2

Execution de le commande d’installation

docker run -d --restart=unless-stopped   -p 80:80 -p 443:443   -v /opt/rancher:/var/lib/rancher --privileged --name=rancher_docker_server -e CATTLE_BOOTSTRAP_PASSWORD=password rancher/rancher:latest 

References

https://techno-tim.github.io/posts/docker-rancher-kubernetes/

Modernisation Infra

La refonte et modernisation de mon d’infrastructure local passe par un hypervisor et un system de containerisation.

Bare métal

  • Proxmox
Proxmox Server Solutions

Virtualize(hypervisor)

  • Windows + Blueiris(sécurité)
  • Firewall (open sense)
  • Ubuntu (docker, kubernetes, rancher)
  • Freenas (file sharing)
File:Logo-ubuntu cof-orange-hex.svg - Wikimedia Commons

Container

  • Home assistant/Home bridge (automation)
  • Pi hole
  • Emby
  • Heimdall Application Dashboard
  • ZoneMinder (sécurité)
  • Unify server (Home network)
  • Next cloud (cloud file)
  • Syncthing (Backup)
  • Web server (wordpress, dokuwiki, sickchill)
  • Perso api
  • Mysql
  • Nginx proxy (Reverse proxy)
  • Prometheus + Grafana (reporting)
  • FTP fillezilla
  • Document Management System
  • Transmission
  • Nzbget
  • Redmine

Docker Logos | Docker