Just Deploy Kubernetes App w/Helm already!

Goal:

Ever heard of Helm? Or Kubernetes? You have? … Are you lying? Nonetheless, below is how to use the tools to easily manage apps in Kubernetes.

Lessons Learned:

  • Do it. Just do it. Install Helm.
    • Helm has official installer script to grab latest version of Helm & install locally
  • Put the lime in the coconut…aka – Install a Helm Chart in the Cluster

Do it. Just do it. Install Helm:

Curl & chmod to get Helm:

Put the lime in the coconut…aka – Install a Helm Chart in the Cluster:

Add Bitnami, update chart listing, & install cert-manager namespace:

View pods, deployment, & services created by installing Helm:

Dude, where is my Helm Chart?

Goal:

Scenario:

  • Uhhhhh dude, wheres my car? REMIX!
  • Uhhhhh dude, where’s my chart? But I have a Kubernetes deployment & I just want to convert it to a Helm chart! Wait you can do that? TEACH ME!

You right now:

Golly, it be nice to have a chart right now…also would be really nice to know how to have a Kubernetes deployment be converted into a Helm chart..Sooooooo, lets use what we got & convert this bad boiiiiii into a ….. HELM CHART (mic drop).

TLDR:

  • Basically your app is in prod already has a manifest & convert it to a helm chart to release the resources w/a template for Kubernetes from a values file

Lessons Learned:

  • Convert Service Manifest into a Service Template in a New Helm Chart
  • Convert Application Manifest into a Deployment Template in a New Helm Chart
  • Check the Manifests & Deploy NodePort Application

Convert Service Manifest into a Service Template in a New Helm Chart:

Make directories & YAML files:

Copy yaml file, update service file, & run Helm:

Convert Application Manifest into a Deployment Template in a New Helm Chart:

Edit values.yaml & copy application.yaml to edit:

Check the Manifests & Deploy NodePort Application:

Run helm install & deploy, get pod/svc details:

TF + EKS = Deployed Yo!

Goal:

Look man, I just wanna set up a tin EKS cluster w/a couple nodes using Terraform.

Lessons Learned:

  • Configure AWS CLI
  • Deploy EKS Cluster
  • Deploy NGINX Pods
  • Destroy!!!

Configure AWS CLI:

Use Access & Secret Access Key:

Change Directory:

Review TF Configuration Files:

Deploy EKS Cluster:

Terraform init, plan, & apply:

Kubectl to chat w/yo EKS cluster:

Check to see your cluster is up & moving:

Deploy NGINX Pods:

Deploy to EKS Cluster:

Check again if your cluster is up… & MOVINGG!:

Destroy!!

Kubernetes Clusters w/EKS is Kewl as (S)hell!

Shells are da bomb right? Just like in Mario Kart! Cloud Shell can be dope too in creating a Kubernetes cluster using EKS, lets party Mario.

  • Create an EKS cluster in a Region
  • Deploy a Application to Mimic the Application
  • Use DNS name of Load Balancer to Test the Cluster

AWS Stuff:

Create EC2:

Download AWS CLI v2, kubectl, ekcctl, & move directory files:

Create the cluster, connect, & verify running eksctl:

Run thru some kubectl applys to yaml files & test to see those pods running:

  • Now curl the load balancer DNS name…walllll-ahhhhh

Deploy Nodes w/Terraform in Kubernetes

Kubernetes is up & running!? Sick! Buuuuuuuuuuuuuuuuuuut, I wanna make some changes – so Imma use Terraform. W/out further a-due… lets get these nodes deployed!

  • Initially set up a cluster using kubectl
  • Deployed NGINX nodes using Terraform
  • As an admin I deployed a NodePort to Kubernetes clstuer w/NGINX Nodes
  • Used Terraform to deploy NodePort & scale NGINX nodes
  • ….DESTROY video boy (…..what is Benchwarmers..)

Set up the goodies:

Check to see cluster is created & get SSL info for server IP address:

Edit Variables file:

Terraform init & apply:

Get the TF config file:

Vim lab_kubernetes_service.tf:

vim lab_kubernetes_resources.tf:

  • Terraform Destroy
  • kind delete cluster –name lab-terraform-kubernetes

Deep Pass of Secret’s to Kubernetes Container

Kubernetes is dope for data bro! Watch how we send configuration data from containers to applications that were stored in secrets & ConfigMaps.

  • Created password file & store it in ….. secrets..
  • Create the Nginx Pod

Generate a file for the secret password file & data:

Vi pod.yml:

Kubectl exec — curl -u user: <PASSWORD> <IP_ADDRESS>:

Be Like 2 Kubernetes in a Pod

Alright alright alright…. lets create a lil baby pod & eventually create an entire Kubernetes application!!

  • Create YAML file w/the pod details for the nginx pod
  • Create the pod…just do it!
  • SSH!!

Vi Nginx.yaml:

Kubectl create -f ~/nginx.yml:

  • Create the pod bro

kubectl get pods -n web:

  • Double check the pod is created dude

kubectl describe pod nginx -n web:

  • Looooook at daaa deeeeetaillllllllzzzuhhh

Falco to Detect Threats on Containers in Kubernetes!

Falco Lombardi is… ahem.. Falco is able to detect any shady stuff going on in your Kubernetes environment in no time.

  • Create a Falco Rules File to Scan the Container
  • Run Falco to Obtain a Report of ALL the Activity
  • Create rule to scan container, basically this scripts rule will:
  • Run Falco for up to a minute & see if anything is detected
    • -r = rule
    • -M = time

Kubernetes Cluster & Terraform

Goal:

Lets see if I can deploy a web app to my EKS cluster & Terraform. After EKS cluster is deployed w/Terraform I’ll provision the cluster & run Node.js & use MongoDB as the backend DB.

Basically it goes like this:

  • Web Browser – – – EKS Cluster – – – Public Endpoint
  • Namespace – – – Node.js – – – Docker Image Repository – – – MongoDB

Lessons Learned:

  • Deploy EKS Cluster w/Terraform:
  • Complete Terraform Configuration:
  • Deploy Web App w/Terraform:
  • Scale Kubernetes Web App:

Deploy EKS Cluster w/Terraform:

  • Cloud User – – – Security Credz – – – Access Keys
  • Add key details in CLI

Couple Commands to Leverage for Sanity Check:

  • LS files
  • Unzip
  • LS
  • CD
  • LS
    • Now can see all TF files

Terraform – init, fmt, apply:

Complete Terraform Configuration:

Double Check its Running:

Couple Commands:

Vim modules/pac-man/pac-man-deployment.tf:

Vim pac-man.tf:

Terraform – Fmt, Init, & Apply:

Deploy Web App w/Terraform:

Scale Kubernetes Web App:

Change Deployment Files

  • MongoDB = 2
  • Pacman Pods = 3

Double Check Working:

Prometheus 2 the movie, Featuring Kubernetes & Grafana

Goal:

Imma monitor a CI/CD pipeline w/3 tools, wanna see if we use Prometheus to synthesize the data & Grafana to display the data? Our goal is get some insight on performance dawg!

Lessons Learned:

  • Use Helm to install Grafana
  • Install Prometheus in Kubernetes Cluster
  • Install Grafana in Kubernetes Cluster

Use Helm to install Grafana

SSH into Master Public IP:

Initiate Helm:

Install Prometheus in Kubernetes Cluster

Create Prometheus YAML File:

Install Prometheus:

Install Grafana in Kubernetes Cluster

Create Grafana YAML File:

Install Grafana:

Create Grafana-Extension YAML File:

Log-in to Grafana: