DevOps Classroom notes 01/Feb/2026

Helm contd

  • Lets write a yaml file to have a deployment and a load balancer
  • Refer Here for helm chart
  • Exercise: Write a simple helm chart in killer code to deploy a pod
  • Lets create two versions of service
    • one with node port
    • other with loadbalancer
  • Load Balancer service
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 80
  selector:
    app: nginx

  • Nodeport
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30080
  selector:
    app: nginx

  • differnces
  • template.yaml
---
apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.name }}-service
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      {{- if eq .Values.service.type "NodePort" }}
      nodePort: {{ .Values.service.nodePort -}}
      {{- else if eq .Values.service.type "LoadBalancer" }}
      targetPort: {{ .Values.service.targetPort -}}
      {{ end }}
  selector:
    app: nginx

  • Values.yaml
---
name: nginx
service:
  type: NodePort
  port: 80
  nodePort: 30080
  targetPort: 80
  • Nodeport
  • LoadBalancer
  • Lets look at deployment file
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.19.0
        ports:
        - containerPort: 80
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "256Mi"

  • deployment with sidecar
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3

  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1

  selector:
    matchLabels:
      app: nginx

  template:
    metadata:
      labels:
        app: nginx
    spec:
      volumes:
        - name: nginx-logs
          emptyDir: {}

      containers:
      # Main application container
      - name: nginx
        image: nginx:1.19.0
        ports:
          - containerPort: 80
        volumeMounts:
          - name: nginx-logs
            mountPath: /var/log/nginx

        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "256Mi"

      # Fluentd sidecar container
      - name: fluentd
        image: fluent/fluentd:v1.16-debian
        volumeMounts:
          - name: nginx-logs
            mountPath: /var/log/nginx

        resources:
          requests:
            cpu: "50m"
            memory: "100Mi"
          limits:
            cpu: "200m"
            memory: "200Mi"

  • In the next section we will write helm for complete aks store Refer Here
  • Exercise: Take any helm chart like mysql chart and generate raw manifest files.
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio
Exit mobile version
%%footer%%