Posts
Deploy Prometheus in K3S Cluster Using Terraform Helm Provider and Helm Chart
run these commands:
cd /opt/terraform/k3s/helm/ mkdir prometheus cd /opt/terraform/k3s/helm/prometheus Create providers.tf file:
nano providers.tf Put this in the file:
provider "kubernetes" { # Configuration options config_path = "/etc/rancher/k3s/k3s.yaml" config_context = "default" } provider "helm" { kubernetes { config_path = "/etc/rancher/k3s/k3s.yaml" config_context = "default" } } Create namespaces.tf file:
nano namespaces.tf put this into the file
resource "kubernetes_namespace" "mysql_ns" { metadata { name = "my-prometheus" } } Create file prometheus.tf
nano prometheus.
Posts
Deploy MySQL in K3S Cluster Using Terraform Helm Provider and Bitnami Helm Chart
Run these commands
cd /opt/terraform/k3s/helm mkdir mysql cd mysql We can get the BitBami helm Charts here: https://artifacthub.io/ Search for bitnami and locate the MySQL Helm Chart https://artifacthub.io/packages/helm/bitnami/mysql
create file providers.tf with this content:
nano providers.tf put this content into the providers.tf file:
provider "kubernetes" { # Configuration options config_path = "/etc/rancher/k3s/k3s.yaml" config_context = "default" } provider "helm" { kubernetes { config_path = "/etc/rancher/k3s/k3s.yaml" config_context = "default" } } Create file namespaces.
Posts
Deploying Trivy in K3S Cluster Using Terraform Helm Provider
Run these commands
sudo su - mkdir /opt/terraform/k3s/helm cd /opt/terraform/k3s/helm mkdir trivy mkdir nginx mkdir grafana mkdir prometheus cd trivy/ create file providers.tf with this content:
nano providers.tf put this content into the providers.tf file:
provider "kubernetes" { # Configuration options config_path = "/etc/rancher/k3s/k3s.yaml" config_context = "default" } provider "helm" { kubernetes { config_path = "/etc/rancher/k3s/k3s.yaml" config_context = "default" } } Create file namespaces.tf
nano namespaces.tf put this in the file:
Posts
This Is Used for Research
1. Example deploy Trivy using Trivy helm Chart source : https://www.youtube.com/watch?v=HYIGljX7w74&list=PLg1ikb8zEVCkoDu3Q9oUbCSeJ9Kxo5LW9&index=4
Notes : https://registry.terraform.io/providers/hashicorp/helm/latest
The provider for K3s:
terraform { required_providers { helm = { source = "hashicorp/helm" version = "2.11.0" } } } provider "helm" { # Configuration options } create file providers.tf with this content:
provider "kubernetes" { config_path = "~/.kube/config" config_context = "kind-trivy-terraform" } provider "helm" { kubernetes { config_path = "~/.kube/config" config_context = "kind-trivy-terraform" } } Create revised provider tf file:
Posts
Use Terraform With Helm on K3S
sudo su - mkdir /opt/terraform/k3s/helm cd /opt/terraform/k3s/helm mkdir trivy mkdir nginx mkdir grafana mkdir prometheus cd trivy/ create file providers.tf with this content:
nano providers.tf put this content into the providers.tf file:
provider "kubernetes" { # Configuration options config_path = "/etc/rancher/k3s/k3s.yaml" config_context = "default" } provider "helm" { kubernetes { config_path = "/etc/rancher/k3s/k3s.yaml" config_context = "default" } } Create file namespaces.tf
nano namespaces.tf put this in the file:
resource "kubernetes_namespace" "trivy_system" { metadata { name = "trivy-system" } } Create file trivy-operator.
Posts
Deploy Nginx Using Manifests to Kubernetes K3S Using Terraform Resources
This tutorial is part 2 of our Terraform/K3S Kubernetes series You need to have looked at this Video first: https://www.youtube.com/watch?v=4DiWQToF6FQ
1. Given we have these Nginx Manifests nginx-deployment.yaml:
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment namespace: mynginx spec: selector: matchLabels: app: nginx replicas: 4 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 nginx-service.yaml
apiVersion: v1 kind: Service metadata: name: nginx namespace: mynginx labels: run: nginx spec: ports: - port: 80 selector: app: nginx 2.
Posts
Use Terraform on K3S
This tutorial is part 1 of our Terraform/K3S Kubernetes series We will provide a link next week to the Video for Part 2 as soon as we publish it
Preface In this lesson we are going to do the following:
Create an Ubuntu VM using our Ubuntu Server Template in our Proxmox VM Server Download the K3S_Auto_Cluster_Generator from our GitHub Repository and Configure it for our Vm servers Create a K3S Kubernetes Cluster using our K3S_Auto_Cluster_Generator Install Helm on our K3S Master Node Ubuntu VM Server Install Terraform on our K3S Master Node Ubuntu VM Server Create and Apply a simple Terraform Kubernetes Namespace project to work and deploy to our K3S Kubernetes cluster We will have learned how to use the Kubernetes Provider for Terraform to deploy infrastructure changes in our K3S Kubernetes Cluster