Erste Schritte mit ohMyHelm¶
Diese Anleitung führt Sie durch die ersten Schritte mit ohMyHelm - von der Installation bis zum ersten Deployment.
Voraussetzungen¶
Bevor Sie beginnen, stellen Sie sicher, dass folgende Tools installiert sind:
-
Helm 3.x - Helm Package Manager für Kubernetes
-
kubectl - Kubernetes Command Line Tool
-
Kubernetes Cluster - Zugriff auf einen funktionierenden Kubernetes Cluster
Schnellstart mit Node-RED¶
Das einfachste Beispiel ist die Deployment einer Anwendung wie Node-RED:
Schritt 1: Projekt erstellen¶
Erstellen Sie ein neues Verzeichnis für Ihr Chart:
Schritt 2: Chart.yaml erstellen¶
Erstellen Sie eine Chart.yaml mit ohMyHelm als Dependency:
apiVersion: v2
name: quickstart
description: Quickstart Example mit ohMyHelm
type: application
version: 0.1.0
appVersion: "1.0.0"
dependencies:
- name: ohmyhelm
alias: nodered
repository: https://gitlab.com/ayedocloudsolutions/ohmyhelm
version: 1.13.0
Schritt 3: values.yaml erstellen¶
Erstellen Sie eine values.yaml mit der Konfiguration:
nodered:
chart:
enabled: true
fullnameOverride: "nodered"
container:
image: nodered/node-red:latest
ports:
- name: http
containerPort: 1880
protocol: TCP
service:
type: ClusterIP
ports:
- port: 1880
targetPort: http
protocol: TCP
name: http
Schritt 4: Dependencies aktualisieren¶
Laden Sie die ohMyHelm Dependency herunter:
Dies erstellt einen charts/ Ordner mit der ohMyHelm Dependency.
Schritt 5: Deployment¶
Deployen Sie das Chart in Ihren Kubernetes Cluster:
Schritt 6: Verifizierung¶
Prüfen Sie, ob das Deployment erfolgreich war:
# Pods anzeigen
kubectl get pods -l app=nodered
# Service anzeigen
kubectl get svc nodered
# Port-Forward für lokalen Zugriff
kubectl port-forward svc/nodered 1880:1880
Öffnen Sie http://localhost:1880 in Ihrem Browser - Node-RED sollte nun laufen!
Lokale Installation¶
Für die Verwendung von ohMyHelm benötigen Sie das Repository lokal:
# Repository clonen
git clone https://gitlab.com/ayedocloudsolutions/ohmyhelm.git
# Direkt installieren
helm install my-app ./ohmyhelm/charts -f my-values.yaml
Beispiel my-values.yaml:
chart:
enabled: true
fullnameOverride: "my-application"
container:
image: nginx:latest
ports:
- name: http
containerPort: 80
protocol: TCP
service:
type: LoadBalancer
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
StatefulSet Beispiel¶
Für Anwendungen, die persistenten Storage benötigen:
apiVersion: v2
name: stateful-app
description: StatefulSet Example
type: application
version: 0.1.0
dependencies:
- name: ohmyhelm
alias: myapp
repository: https://gitlab.com/ayedocloudsolutions/ohmyhelm
version: 1.13.0
# values.yaml
myapp:
chart:
enabled: true
statefulset: true # StatefulSet statt Deployment
fullnameOverride: "myapp"
container:
image: postgres:14
ports:
- name: postgres
containerPort: 5432
protocol: TCP
env:
- name: POSTGRES_PASSWORD
value: "changeme"
statefulsetVolume:
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
Mehrere Anwendungen in einem Chart¶
Sie können mehrere ohMyHelm-Instanzen in einem Chart kombinieren:
# Chart.yaml
apiVersion: v2
name: multi-app
description: Multiple apps with ohMyHelm
type: application
version: 0.1.0
dependencies:
- name: ohmyhelm
alias: frontend
repository: https://gitlab.com/ayedocloudsolutions/ohmyhelm
version: 1.13.0
- name: ohmyhelm
alias: backend
repository: https://gitlab.com/ayedocloudsolutions/ohmyhelm
version: 1.13.0
- name: ohmyhelm
alias: database
repository: https://gitlab.com/ayedocloudsolutions/ohmyhelm
version: 1.13.0
# values.yaml
frontend:
chart:
enabled: true
fullnameOverride: "frontend"
container:
image: nginx:alpine
ports:
- name: http
containerPort: 80
backend:
chart:
enabled: true
fullnameOverride: "backend"
container:
image: node:18
ports:
- name: http
containerPort: 3000
database:
chart:
enabled: true
statefulset: true
fullnameOverride: "database"
container:
image: postgres:14
ports:
- name: postgres
containerPort: 5432
Helper ohne Chart verwenden¶
Sie können auch nur die Helper-Funktionen ohne Chart verwenden:
# Chart.yaml
apiVersion: v2
name: helpers-only
description: Using only ohMyHelm helpers
type: application
version: 0.1.0
dependencies:
- name: ohmyhelm
alias: helpers
repository: https://gitlab.com/ayedocloudsolutions/ohmyhelm
version: 1.13.0
# values.yaml
helpers:
# chart.enabled ist false oder nicht gesetzt
# Erstelle Namespaces
namespaces:
spaces:
- name: development
- name: staging
- name: production
# Erstelle Secrets
secrets:
- name: my-secret
namespace: default
values:
username: admin
password: "" # Wird automatisch generiert
# Erstelle ConfigMaps
configs:
- name: my-config
namespace: default
values:
app.yaml: |
server:
host: 0.0.0.0
port: 8080
Wichtige Helm-Befehle¶
# Dependencies aktualisieren
helm dependency update
# Chart installieren
helm install RELEASE_NAME . --namespace NAMESPACE
# Chart upgraden
helm upgrade RELEASE_NAME . --namespace NAMESPACE
# Release löschen
helm uninstall RELEASE_NAME --namespace NAMESPACE
# Releases anzeigen
helm list --all-namespaces
# Release-Werte anzeigen
helm get values RELEASE_NAME --namespace NAMESPACE
# Dry-run (ohne Installation)
helm install RELEASE_NAME . --dry-run --debug
Debugging¶
Wenn etwas nicht funktioniert:
# Template rendern ohne Installation
helm template my-release . --debug
# Mit ausführlicher Ausgabe installieren
helm install my-release . --debug --namespace default
# Generierte Manifests anzeigen
helm get manifest my-release --namespace default
# Kubernetes-Ressourcen prüfen
kubectl get all -l app=my-app
kubectl describe pod <pod-name>
kubectl logs <pod-name>
Nächste Schritte¶
Jetzt, da Sie Ihr erstes Deployment erstellt haben:
- Verwendung - Lernen Sie alle Konfigurationsoptionen kennen
- Beispiele - Entdecken Sie praktische Beispiele für verschiedene Szenarien
- Use Cases - Typische Einsatzszenarien und Best Practices
- Chart-Optionen - Detaillierte Dokumentation aller Chart-Optionen
- Helper-Funktionen - Dokumentation der Helper-Funktionen
Troubleshooting¶
"Error: failed to download"¶
ohMyHelm muss lokal verfügbar sein:
# Clonen Sie das Repository
git clone https://gitlab.com/ayedocloudsolutions/ohmyhelm.git
# Oder laden Sie eine Release-Version herunter
wget https://gitlab.com/ayedocloudsolutions/ohmyhelm/-/archive/v1.13.0/ohmyhelm-v1.13.0.tar.gz
tar xzf ohmyhelm-v1.13.0.tar.gz
"Error: INSTALLATION FAILED: 1 error occurred"¶
Prüfen Sie die Logs mit:
helm install my-release . --debug --namespace default
kubectl get events --namespace default --sort-by='.lastTimestamp'