Kubernetes-helm-charts

 

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 https://www.youtube.com/watch?v=-ykwb1d0DXU

https://www.youtube.com/watch?v=pHGc87zHLlo&list=PL7iMyoQPMtANm_35XWjkNzDCcsw9vy01b

Helm Installation 

https://jhooq.com/building-first-helm-chart-with-spring-boot/

Helm chart : Github repo
https://github.com/helm/helm

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Main Concepts of Helm Chart .

Helm changes a lot between version to version

  • What is Helm?
  • What are Helm Charts ?
  • What to use them ?
  • When to use them
  • What is Tiller ?

used for

-- Package Manager for kubernetes. something like yum , apt
-- It is a convinient way for packaging collections of kubernetes  yaml files distributing them in public and private registry 

Lets break them down with specific exams .

Lets say you have deployed your application on kubernetes cluster and you want to deploy the Elastic Search additionally in your kubernetes cluster

 


 Installing Helm chart : 

There are loads of installation packages that you can use to install Helm charts



Helm Chart structure :

basically dividend into three parts :

  • chart.yaml 
  • template
  • values.yaml

syntax :

$ helm create chart

$ helm create demochart

running the above command creates the below. 


chart.yaml   -- file containes the below. This has the metadata









values.yml  --











In Helm, the values.yaml file is a key component used to customize and parameterize Helm charts during the installation process. It allows users to provide input values that can be used to configure various aspects of the chart's deployment.

Here's how the values.yaml file works and its significance:

  1. Customization and Parameterization: The values.yaml file serves as a central place to define input values that will be used to configure the Helm chart's resources. Instead of hardcoding configuration values directly into the chart's templates, you can use placeholders in the templates and then supply the actual values through the values.yaml file during installation.

  2. Default Values: The values.yaml file can include default values for various configuration settings. These defaults provide a baseline configuration for the Helm chart, which can be overridden during installation.

  3. Overriding Values: When you install a Helm chart, you can use the --values or -f flag to provide an external YAML file containing specific values that override the defaults defined in values.yaml. This allows you to tailor the chart's configuration to match your environment.

  4. Structuring Configuration: The values.yaml file can be structured hierarchically to group related configuration settings. This helps keep the configuration organized and makes it easier to manage complex deployments.

Here's a simple example of a values.yaml file for a hypothetical application Helm chart:


Let's see how kubernetes day-to-day operation look like without a helm chart. 

The only command that you may need to run is help , of course u need to create the kubernetes cluster.
and tweak the values.yml file create the place holder after which you only need to run

helm install

we assume the helm is installed and the kubernetes cluster is deployed.

Creating our first helm chart. 

The first thing we are about to do is create a helm chart.

helm create springboot


Let see how our helm chart structure look like.

$ tree <chart_name>

Commands used : 

$ helm create springboot 

 

The helm create command generates the configuration files for a Helm chart based on a predefined template. The template consists of various files and directories that follow a standardized structure. When you run helm create springboot, Helm creates a directory named "springboot" (assuming it doesn't already exist) and generates the necessary files and subdirectories within that directory.

Here's a breakdown of what the helm create command typically generates:

  1. Chart.yaml: This YAML file contains metadata about the chart, such as its name, version, description, and other information.

  2. values.yaml: This YAML file contains default values that can be overridden by users when installing the chart. These values are used to parameterize the templates.

  3. charts/: This directory can be used to store any sub-charts that your main chart depends on. Sub-charts allow you to encapsulate and reuse components.

  4. templates/: This directory contains the template files for Kubernetes manifests. These templates use Go templating language and are used to generate the actual YAML files that define the Kubernetes resources (e.g., Deployments, Services, ConfigMaps) when the chart is installed. The template files have the .yaml extension and can include placeholders for values defined in values.yaml.

  5. helpers.tpl: This file contains template snippets and functions that can be included in the main template files in the templates/ directory. It's used to promote code reuse and keep templates DRY (Don't Repeat Yourself).

  6. tests/: This directory can contain test files that help ensure the chart's functionality.

  7. _helpers.tpl: This is a special file that provides global helper functions and variables for the chart's templates.

The helm create command uses a predefined template to generate these files and directories in the specified chart directory. The template is designed to provide a starting point for creating a Helm chart for your application. Once these files are generated, you can customize them to match the specifics of your Spring Boot application and its deployment needs.

It's important to note that the exact template used by helm create may vary based on the Helm version and any customizations you have made to your Helm environment. Always refer to the Helm documentation for the most accurate and up-to-date information.

 

$ helm template springboot  // one directory out

$ helm lint springboot  // check if there is any problem with your helm chart it will highlight those. syntatical mistake or incorrect value.

$ help -debug -dry-run // before helm install command to dry-run

example

$ helm install springboot -debug -dry-run springboot

 -- this is a release name >  install springboot

Install helm chart command below

$ helm install <release_name> sprintboot

$ helm install myfirstsprintboot springboot

check the status of your helm installation

$ helm list -a





 








Certainly! Here are some commonly used Helm charts that are often installed in production applications to manage various aspects of Kubernetes deployments:

  1. NGINX Ingress Controller: Helm Chart: nginx-stable/nginx-ingress Description: Installs the NGINX Ingress Controller, which manages external access to services within a Kubernetes cluster.

  2. Prometheus and Grafana: Helm Chart: prometheus-community/kube-prometheus-stack Description: Installs Prometheus for monitoring and Grafana for visualization and analytics of metrics in a Kubernetes environment.

  3. MySQL Database: Helm Chart: bitnami/mysql Description: Deploys a MySQL database instance, configurable with various settings, suitable for stateful applications.

  4. Redis Cache: Helm Chart: bitnami/redis Description: Sets up a Redis cache instance, often used for caching data and improving application performance.

  5. Elasticsearch and Kibana: Helm Chart: elastic/helm-charts Description: Installs Elasticsearch for centralized logging and Kibana for log visualization and analysis.

  6. Jenkins CI/CD Server: Helm Chart: jenkins/jenkins Description: Deploys Jenkins, a popular continuous integration and continuous deployment (CI/CD) tool.

  7. Minio Object Storage: Helm Chart: minio/minio Description: Installs Minio, an object storage server compatible with Amazon S3, for managing and storing files.

  8. Cert-Manager: Helm Chart: jetstack/cert-manager Description: Sets up Cert-Manager to manage SSL/TLS certificates for your applications.

  9. WordPress and MariaDB: Helm Chart: bitnami/wordpress Description: Deploys WordPress along with a MariaDB database, providing a platform for content management systems.

  10. Kafka and ZooKeeper: Helm Chart: bitnami/kafka Description: Installs Apache Kafka and ZooKeeper for building event-driven applications and processing streams of data.

  11. GitLab: Helm Chart: gitlab/gitlab Description: Sets up GitLab, an integrated web-based Git repository manager, for source code management and CI/CD.

Please note that the Helm charts listed here may be subject to updates and changes over time. It's important to refer to the official Helm chart repositories and documentation to ensure you are using the latest and most appropriate versions for your specific use case.

Upgrade Helm Release :

make the changes to

apiVersion: v2
name: springboot
description: A Helm chart for Kubernetes
type: application
version: 0.1.1
appVersion: 1.16.0

 
replicaCount: 2
 

save the files. 

 
command to upgrade

$ helm upgrade myfirstspringboot   // the above changes made is upgraded.

Rolling back an upgrade : command

$ helm rollback myfirstspringboot 1  // 1 is the version number.

check the release : command

helm list -a  // lists down all your releases
Now after the roll back in the helm world the revision number gets increamented by 1.

How to delete the helm releases :

Command :

syntax : helm delete <release_name>

$ helm delete myspringboot


Upstream repositories : you can add an helm chart available in the repository online to your you local repo

check the upstream repos on your local system

$  helm repo list   // checking if we have added any helm chart from online repos to our local repo'

Adding a repo to your helm

$ helm repo add <repository_name> <repository_url>

$ helm repo add bitnami <bitnami_url>

now if you check

$  helm repo list


command : another command to search in your local repo.

$ helm search repo bitnami

This will show all the repos that is available inside the bitnami. All the helm charts available inside Bitnami .

if you want to pull in the latest updates from bitnami repository

$ help repo update

Index Helm chart repository

If you look at the file structure. This does not have an "index.yaml"


$ helm repo index helloworld // this adds an index.yaml

This adds a file "index.yaml" file to the file structure.

: Remove helm chart repository

$ helm repo remove bitnami


---

: Helm charts plugins : What is Helm Chart "Plugins" and how to use it. - Part 4

Helm chart community provides loads of plugins for different purposes.

Why we need plugins ?

Helm diff plugin.

The features provided by this plugin are

-- you can identify the differences between your helm chart
-- based on difference between you version


How we are going to create the release and how we are going to use helm diff plugin



$ helm plugin list  // check if any plugin is installed in the local repo

https://jhooq.com/helm-chart-plugin/

helm diff revision myhelloworld 1 2

===

: Bitnami - https://jhooq.com/helm-chart-wordpress-installation/

To do this you cannot do this in your local kubernetes setup you may need the cloud setup to do this.








Comments

Popular posts from this blog

Helm -Commands

Helm - WIth ArgoCD

Helm Chart Directory structure