linking volumes and ports in helm chart


apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "rmq.fullname" . }}
  labels:
    app: {{ template "rmq.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "rmq.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      {{- with .Values.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "rmq.labels" . | nindent 8 }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.dockerRegistry }}{{ .Values.image.repository }}{{ .Values.image.imageName }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            {{- range .Values.service.ports }}
            - name: {{ .name }}
              protocol: {{ .protocol }}
              containerPort: {{ .targetPort }}
            {{- end }}
          env:       
          - name: "RABBITMQ_DEFAULT_USER"
            valueFrom:
              secretKeyRef:
                name: {{ .Values.secretName | quote }}
                key: "RABBITMQ_DEFAULT_USER"
          - name: "RABBITMQ_DEFAULT_PASS"
            valueFrom:
              secretKeyRef:
                name: {{ .Values.secretName | quote }}
                key: "RABBITMQ_DEFAULT_PASS"
          - name: "CERT"
            valueFrom:
              secretKeyRef:
                name: {{ .Values.secretName | quote }}
                key: "CERT"
          - name: "CERT_KEY"
            valueFrom:
              secretKeyRef:
                name: {{ .Values.secretName | quote }}
                key: "CERT_KEY"
          
          # ports:
          #     containerPort: {{ .Values.service.containerPort }}
          livenessProbe:
            httpGet:
              scheme: {{ .Values.livenessProbe.httpGet.scheme | default "HTTP" }}
              path: {{ .Values.livenessProbe.httpGet.path }}
              port: {{ .Values.livenessProbe.httpGet.port }}
            initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.livenessProbe.periodSeconds }}

          readinessProbe:
            httpGet:
              scheme: {{ .Values.livenessProbe.httpGet.scheme | default "HTTP" }}
              path: {{ .Values.readinessProbe.httpGet.path }}
              port: {{ .Values.readinessProbe.httpGet.port }}
            initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
            
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
          {{- with .Values.volumeMounts }}
          volumeMounts:
            {{- toYaml . | nindent 12 }}
          {{- end }}
      {{- with .Values.volumes }}
      volumes:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      
      dnsPolicy: Default

below is the values.yaml file


# Default values for rmq.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1
namespace: 
  create: true 
  name: ns-rabbitmq-dev

image:
  containerName: rabbitmq-3
  dockerRegistry: docker-bda.com.stihl-dns.net:443
  imageName: rabbitmq-3
  pullPolicy: IfNotPresent
  repository: /stihl/
  # Overrides the image tag whose default is the chart appVersion.
  tag: "u20.04_002_r3_001"
  #image: 'docker-bda.com.stihl-dns.net:443/stihl/rabbitmq-3:u20.04_002_r3_001'

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
  # Specifies whether a service account should be created
  create: true
  # Automatically mount a ServiceAccount's API credentials?
  automount: true
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name: ""

podAnnotations: {}
podLabels: {}

podSecurityContext: {}
  # fsGroup: 2000

securityContext: {}
  # capabilities:
  #   drop:
  #   - ALL
  # readOnlyRootFilesystem: true
  # runAsNonRoot: true
  # runAsUser: 1000

# service:
#   name: rabbitmq-trial1
#   type: ClusterIP   
#   portName: rmq 
#   protocol: TCP
#   containerPort: 5672 
#   port: 5672 
service:
  name: rabbitmq-trial1
  type: ClusterIP   
  ports:
    - name: rmq
      protocol: TCP
      port: 5672
      targetPort: 5672
    - name: management
      protocol: TCP
      port: 15672
      targetPort: 15672

ingress:
  enabled: false
  className: ""
  annotations: {}
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  hosts:
    - host: chart-example.local
      paths:
        - path: /
          pathType: ImplementationSpecific
  tls: []
  #  - secretName: chart-example-tls
  #    hosts:
  #      - chart-example.local

livenessProbe:
  httpGet:
    scheme: HTTPS
    path: /
    port: 5672
  initialDelaySeconds: 3
  periodSeconds: 3

readinessProbe:
  httpGet:
    scheme: HTTPS
    path: /
    port: 5672 
  initialDelaySeconds: 3
  periodSeconds: 3

# livenessProbe:
#   httpGet:
#     path: /
#     port: http
# readinessProbe:
#   httpGet:
#     path: /
#     port: http

autoscaling:
  enabled: false
  minReplicas: 1
  maxReplicas: 100
  targetCPUUtilizationPercentage: 80
  # targetMemoryUtilizationPercentage: 80


volumes:
  - name: data
    hostPath: "./data"
    mountPath: "/var/lib/rabbitmq"
  - name: log
    hostPath: "./log"
    mountPath: "/var/log/rabbitmq"
  - name: config
    hostPath: "./config"
    mountPath: "/etc/rabbitmq"
    
# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
#   secret:
#     secretName: mysecret
#     optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
#   mountPath: "/etc/foo"
#   readOnly: true

nodeSelector: {}

tolerations: []

affinity: {}

secretName: certificate-secrets
env:
  RABBITMQ_DEFAULT_USER: 'admin'
  RABBITMQ_DEFAULT_PASS: 'admin2024'
  CERT: |-
        -----BEGIN CERTIFICATE-----
               blablabla
        -----END CERTIFICATE-----
  CERT_KEY: |-
        -----BEGIN RSA PRIVATE KEY-----
                bla bla bla
        -----END RSA PRIVATE KEY-----

  #Azure AD
    # APPLICATION_ID:
    # TENANT_ID:
    # CLIENT_SECRET:
    # AZURE_AD_JWKS_URI:

and this is service.yaml file

apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.service.name }}
  labels:
    {{- include "rmq.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    {{- range .Values.service.ports }}
    - name: {{ .name }}
      protocol: {{ .protocol }}
      port: {{ .port }}
      targetPort: {{ .targetPort }}
    {{- end }}
    # - port: {{ .Values.service.port }}
    #   targetPort: {{ .Values.service.containerPort}}
    #   protocol: {{ .Values.service.protocol}}
    #   name: {{ .Values.service.portName}}
  selector:
    {{- include "rmq.selectorLabels" . | nindent 4 }}


and this is secret.yaml file

apiVersion: v1
kind: Secret
metadata:
  name: {{ .Values.secretName }}
  labels:
    {{- include "rmq.labels" . | nindent 4 }}
stringData: 
  RABBITMQ_DEFAULT_USER: {{ .Values.env.RABBITMQ_DEFAULT_USER | quote }}
  RABBITMQ_DEFAULT_PASS: {{ .Values.env.RABBITMQ_DEFAULT_PASS | quote }}
  CERT: {{ .Values.env.CERT | quote }}
  CERT_KEY: {{ .Values.env.CERT_KEY | quote }}

i am trying to create helm chart for rabbitmq at my work. and i am confused how to link volumes and multiple ports in it . i have share all relevant files . kindly tell me if i am making any mistaked as I am not able to deploy my helm chart on rancher.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật