Charts و values.yaml
ما هي Chart؟
Section titled “ما هي Chart؟”Chart هي package لتطبيق Kubernetes. تحتوي templates و values.
web-chart/ Chart.yaml values.yaml templates/ deployment.yaml service.yamlvalues.yaml
Section titled “values.yaml”values.yaml يحتوي القيم التي تتغير بين البيئات.
image: repository: nginx tag: "1.27"
replicaCount: 3
service: port: 80Template بسيط
Section titled “Template بسيط”apiVersion: apps/v1kind: Deploymentmetadata: name: {{ .Release.Name }}spec: replicas: {{ .Values.replicaCount }} template: spec: containers: - name: web image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"أوامر مهمة
Section titled “أوامر مهمة”helm lint ./web-charthelm template web ./web-charthelm install web ./web-charthelm upgrade web ./web-charthelm rollback web 1helm uninstall webملفات قيم متعددة
Section titled “ملفات قيم متعددة”helm upgrade --install web ./web-chart -f values-dev.yamlhelm upgrade --install web ./web-chart -f values-prod.yamlLab: تحويل Deployment إلى Chart
الهدف: جعل image tag و replicaCount قابلين للتغيير.
ابدأ من Deployment و Service في الدروس السابقة، ثم ضع القيم المتغيرة داخل values.yaml.