EKS - Cluster Autoscaler and Horizontal Pod Autoscaler (HPA)

“Explore how pods and EC2 nodes can be scaled in EKS cluster " Autoscaler and Horizontal Pod Autoscaler (HPA) Practice on EKS In last post, I was able to deploy EKS cluster via Jenkins and Terraform: Jenkins - Multi-Destnation Continuse Deployment with Terraform This post walks through the process of setting up an Autoscaler and Horizontal Pod Autoscaler (HPA) in an Amazon EKS cluster. We will explore how to dynamically scale the number of nodes in EKS cluster and how to autoscale K8S pods based on CPU utilization using HPA. ...

12 September 2024 · 7 min · Zack Zhou

Helm + Kustomize for ZackBlog

Kustomize is a configuration management tool for Kubernetes that allows users to customize application manifests without modifying the original YAML files, in this post I will explore Kustomize with overlays, bases, and transformers, then create simple kustomization.yaml files for different environments using Zackblog, then to practice using Kustomize’s built-in resources like configMapGenerator and secretGenerator. Let’s take Zackblog k8s deployment manifest as an example and convert it into a Kustomize setup. We will start by organizing the files and gradually exploring key Kustomize features. ...

12 March 2024 · 8 min · Zack Zhou

Istio: Distributed Tracing with Jaeger

Last post we were able to deploy Istio and manage traffic for a book review microservice application. This session we will dive deeper into Istio for its add-on Jaeger for Microservice tracing. Jaeger is an open-source end-to-end distributed tracing tool to monitor and troubleshoot the performance of microservices-based distributed systems by providing insights into the latency and other performance metrics. Trace A trace represents the entire journey of a request or transaction as it propagates through various services and components of a distributed system. It captures the path the request takes, including all the microservices it interacts with, from start to finish. A trace is composed of multiple spans. ...

24 December 2023 · 4 min · Zack Zhou

Istio: Traffic Routing

Here we use helm to install istio (istio-base, istiod, istio gateway), then deploy a sample online book store microservice “bookinfo”. Practise istio tasks include Traffic Management, Observability, Security. Bookinfo Topology: Helm install istio (istiod, istio-ingress) kubectl create namespace istio-system helm pull istio/base helm install istio-base . -n istio-system --set defaultRevision=default helm pull istio/istiod helm install istiod . -n istio-system kubectl create namespace istio-ingress helm pull istio/gateway helm install istio-ingress . -n istio-ingress helm ls -n istio-system NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION istio-base istio-system 1 2023-12-17 08:14:06.943276388 +0800 CST deployed base-1.20.1 1.20.1 istiod istio-system 1 2023-12-17 08:15:40.370551503 +0800 CST deployed istiod-1.20.1 1.20.1 helm ls -n istio-ingress NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION istio-ingress istio-ingress 1 2023-12-17 08:25:07.111999373 +0800 CST deployed gateway-1.20.1 1.20.1 Deploy bookinfo microservice and istio ingressgateway and virtualservice kubectl label namespace istio-system istio-injection=enabled kubectl apply -f https://github.com/istio/istio/blob/master/samples/bookinfo/platform/kube/bookinfo.yaml -oyaml > bookinfo.yaml kubectl apply -f bookinfo.yaml kubectl get po NAME READY STATUS RESTARTS AGE details-v1-698d88b-wmfcb 2/2 Running 0 21m ratings-v1-6484c4d9bb-cb6gx 2/2 Running 0 21m reviews-v1-5b5d6494f4-jrsvc 2/2 Running 0 21m reviews-v2-5b667bcbf8-jgfzj 2/2 Running 0 21m reviews-v3-5b9bd44f4-tmmfz 2/2 Running 0 21m kubectl apply -f https://github.com/istio/istio/blob/master/samples/bookinfo/networking/bookinfo-gateway.yaml -oyaml > bookinfo-gateway.yaml kubectl apply -f bookinfo-gateway.yaml Deploy Kiali, jaeger, grafana, prometheus wget https://raw.githubusercontent.com/istio/istio/release-1.20/samples/addons/prometheus.yaml wget https://raw.githubusercontent.com/istio/istio/release-1.20/samples/addons/jaeger.yaml wget https://raw.githubusercontent.com/istio/istio/release-1.20/samples/addons/grafana.yaml kubectl create -f prometheus.yaml -f jaeger.yaml -f grafana.yaml Visit http://book.istio:31000/productpage, with review (v1, v2, v3) ...

22 December 2023 · 2 min · Zack Zhou

Move To Rancher

My current employer using Rancher, due to the vender prefers this?? So far many different ways I have used to deploy k8s cluster, each with its own pros and cons. home lab build k8s components (etcd, keepalived, apiserver, scheduler, coreDNS, calico) home lab k8s cluster with kubeadm k8s on AWS using kops and eksctl AWS self-managed k8s cluster directly on ec2 by ansible Rancher Support matrix Local docker Installation ...

26 June 2023 · 4 min · Zack Zhou

Kubespary with Terraform on AWS

Kubespary is a powerful and highly configurable tool that automates and supports deployment on various cloud providers (AWS, GCE, Azure, etc.) and on-premises infrastructure. In this post I will run its build-in Terraform and ansible code to provision a k8s cluster based on AWS EC2. Benefit of Kubespary We can define specific settings in cluster-config.yaml for networking, authentication, and other Kubernetes features, it also supports for multiple networking plugins (Calico, Flannel, Weave Net, etc.), By managing hosts file and rerun the playbook to make add or remove nodes easily, Integrated CI/CD Pipelines and Infrastructure as Code (IaC) with Terraform and Ansible to achieve automation. ...

24 May 2023 · 4 min · Zack Zhou

Redis cluster with Helm

Today we are playing around with Redis, Here we use helm to install Redis cluster, then validate statefulset storage and cluster availability. Typical Redis cluster (3 master + 3 slave for slots) Topology: Helm install bitnami/redis-cluster helm repo add bitnami https://charts.bitnami.com/bitnami helm pull bitnami/redis-cluster kubectl create ns redis helm install zz-redis bitnami/redis-cluster -n redis Redis-cluster status kubectl get po | grep zz-redis zz-redis-redis-cluster-0 1/1 Running 3 (33m ago) 36m zz-redis-redis-cluster-1 1/1 Running 1 (32m ago) 36m zz-redis-redis-cluster-2 1/1 Running 1 (33m ago) 36m zz-redis-redis-cluster-3 1/1 Running 1 (33m ago) 36m zz-redis-redis-cluster-4 1/1 Running 1 (33m ago) 36m zz-redis-redis-cluster-5 1/1 Running 1 (33m ago) 36m kubectl get svc zz-redis-redis-cluster ClusterIP 10.96.68.34 <none> 6379/TCP 37m zz-redis-redis-cluster-headless ClusterIP None <none> 6379/TCP,16379/TCP 37m kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE redis-data-zz-redis-redis-cluster-0 Bound pvc-81f69c15-2f59-4704-9fec-c3ab217ebca5 1Gi RWO rook-ceph-block 37m redis-data-zz-redis-redis-cluster-1 Bound pvc-871dbb68-a78b-48a8-8feb-8726eb8a795e 1Gi RWO rook-ceph-block 37m redis-data-zz-redis-redis-cluster-2 Bound pvc-afd8c82e-c314-426a-a3cd-3c8d10b42bb1 1Gi RWO rook-ceph-block 37m redis-data-zz-redis-redis-cluster-3 Bound pvc-e8fd5d47-dd60-4358-8cf5-a17d6574bbe2 1Gi RWO rook-ceph-block 37m redis-data-zz-redis-redis-cluster-4 Bound pvc-04d4f148-b7c1-407e-b9a8-b2fa911405f0 1Gi RWO rook-ceph-block 37m redis-data-zz-redis-redis-cluster-5 Bound pvc-99e8b2cc-c5d5-4636-a19b-042922eca3cc 1Gi RWO rook-ceph-block 37m Validate cluster by set key ...

9 December 2022 · 2 min · Zack Zhou

Apache Kafka cluster with testing topics

Apache Kafka has proven to be an extremely popular event streaming platform, as its scalable distributed architecture, high performance, and use cases, some key terms and concepts as below: Kafka clusters and Kafka brokers Kafka clients and servers Producers, and Consumers, and Consumer groups Kafka topics & Kafka partitions, offsets Kafka topic replication, leaders, and followers ZooKeeper or not Typical Kafka Topology: Helm install bitnami/kafka Here we use helm to install Kafka, then validate statefulset storage and cluster availability by creating a topic, producer, and consumer. ...

9 December 2022 · 2 min · Zack Zhou

Ingress controller for Subdomain based Routing

In this post I will run the steps required to set up MetalLB for LoadBalancer IP allocation, the NGINX Ingress Controller for routing traffic based on subdomains, and how to configure local DNS to enable subdomain-based routing for Kubernetes services. Ingress-nginx install We will use Helm to install our ingress controller ingress-nginx, which will be used to route traffic based on subdomains. # install ingress controller ingress-nginx helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx helm repo update helm -n ingress-nginx install ingress-nginx ingress-nginx/ingress-nginx --create-namespace # check for ingressclasses kubectl get ingressclasses.networking.k8s.io NAME CONTROLLER PARAMETERS AGE nginx k8s.io/ingress-nginx <none> 149m MetalLB for loadbalancing ...

18 November 2022 · 3 min · Zack Zhou

Rook-Ceph for dynamic Persistent Volume

Today, I will explore how to install and configure Persistent Volume for all the deployment in K8S to consume. Helm install Rook-Ceph for persistent storage Configure local VM block storage to add 50Gb sdb to all k8s master and worker nodes Install rook-ceph cluster git clone --single-branch --branch master https://github.com/rook/rook.git cd rook/deploy/examples kubectl create -f crds.yaml -f common.yaml -f operator.yaml kubectl create -f cluster.yaml Ceph toolbox to check cluster status kubectl create -f toolbox.yaml kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- bash ceph status ceph osd status ceph df rados df Ceph Dashboard service for HTTPS login kubectl create -f dashboard-external-https.yaml kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o jsonpath="{['data']['password']}" | base64 --decode && echo Create storage pool and storage class kubectl create -f pool.yaml cd csi/rbd kubectl create -f storageclass.yaml Set “rook-ceph-block” as the default storage class kubectl patch storageclass rook-ceph-block -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' kubectl get sc NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE rook-ceph-block (default) rook-ceph.rbd.csi.ceph.com Delete Immediate true 8d Check pool and OSDs in Ceph web UI ...

9 November 2022 · 1 min · Zack Zhou