# alijahnas/cka-practice-exercises architecture

> Architecture diagram of the GitHub repository alijahnas/cka-practice-exercises, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alijahnas/cka-practice-exercises
- Repository: https://github.com/alijahnas/cka-practice-exercises

## Overview

##### Project Type and Purpose
- This repo is an educational/infrastructure-as-code project to practice for the Certified Kubernetes Administrator (CKA) exam.
- Its main “runtime” is a Kubernetes cluster you provision, configure, and exercise against.

##### File Structure
- Top-level scripts and docs:
– containerd-install.sh: bootstrap container runtime
– *.md files: exercise modules for each CKA domain
- terraform/ : IaC definitions (cluster-infra.tf)
- Supporting docs: troubleshooting.md, services-networking.md, storage.md, workloads-scheduling.md, cluster-architecture-installation-configuration.md

##### README
- Explains the five exam domains and links to each module.
- Encourages use of “Kubernetes the Hard Way” and official docs.
- Describes exam workflow: multiple clusters, CLI-first, time-boxed.

##### Main Components
a. Infrastructure Provisioning (Terraform)
- Cloud VPC/Network
- Master and Worker VMs (compute instances)
b. Base OS + Container Runtime
- containerd (installed via containerd-install.sh)
c. Kubernetes Cluster
- Control Plane (kube-apiserver, etcd, controller-manager, scheduler)
- Worker Nodes (kube-let, kube-proxy)
d. Exercise Modules (Mapping to K8s constructs)
- Cluster Architecture & Installation (bootstrap flows)
- Workloads & Scheduling (Deployments, Pods, DaemonSets)
- Services & Networking (Services, Ingress, CNI plugin)
- Storage (PersistentVolume, StorageClass)
- Troubleshooting (kubectl, logs, events)
e. External Dependencies
- Official Kubernetes docs (kubernetes.io)
- Container registry (e.g., Docker Hub)

##### Relationships and Interactions
- Terraform → provisions VMs & network
- VMs → run containerd (via install script) → enable kube-adm or manual kube-let
- Control Plane ↔ Worker Nodes communicate over CNI
- kubectl (on admin workstation) ↔ kube-api server for exercises
- Workloads ↔ Services ↔ Networking plugin
- Workloads ↔ PVs (storage backend)
- Troubleshooting uses logs, events, exec into pods

##### Architectural Patterns & Principles
- Declarative IaC for infra (Terraform HCL)
- Immutable nodes with containerd + kubeadm bootstrap
- Modular “exercise” documentation separated by domain
- Layered architecture: Infra → Platform → Workloads → Observability

##### Technologies & Frameworks
- Terraform (IaC)
- containerd, kubeadm, kube-let, kube-proxy
- Kubernetes CNI (e.g., Calico, Flannel)
- YAML manifests for K8s resources
- Bash scripts for automation

##### Putting It All Together
- On the left, show Terraform & containerd-install.sh driving VM creation & bootstrap.
- Provisioning → Bootstrap → Operations (kubectl → API)
- Data flow between pods, services, and storage.

##### Detail Without Over-Complexity
- Layer explicitly but avoid drawing every single Kubernetes micro-service.
- Modules, the IaC → cluster → exercises flow, and the exam-style interaction via kubectl.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infrastructure Layer
    subgraph "Infrastructure"
        Terraform["Terraform"]:::infra
    end

    %% Script Layer
    Containerd["containerd-install.sh"]:::script
    Admin["Admin Workstation (kubectl)"]:::script

    %% Provisioning and Bootstrap
    Terraform -->|"provision"| MasterVM["Master VM"]:::platform
    Terraform -->|"provision"| WorkerVM["Worker VM"]:::platform
    Containerd -->|"install containerd"| MasterVM
    Containerd -->|"install containerd"| WorkerVM

    %% Kubernetes Control Plane
    subgraph "Master Node"
        APIS["kube-apiserver"]:::platform
        ETCD["etcd"]:::platform
        CTLR["controller-manager"]:::platform
        SCH["scheduler"]:::platform
    end
    MasterVM --> APIS
    MasterVM --> ETCD
    MasterVM --> CTLR
    MasterVM --> SCH

    %% Kubernetes Worker
    subgraph "Worker Node"
        KLET["kubelet"]:::platform
        KPROX["kube-proxy"]:::platform
    end
    WorkerVM --> KLET
    WorkerVM --> KPROX

    %% Admin interactions
    Admin -->|"kubectl apply"| APIS

    %% Exercise Modules
    RD["README.md"]:::doc
    CR["cluster-architecture-installation-configuration.md"]:::doc
    WS["workloads-scheduling.md"]:::workload
    SN["services-networking.md"]:::workload
    ST["storage.md"]:::workload
    TR["troubleshooting.md"]:::doc

    %% Doc relations
    RD -->|"links to modules"| CR
    RD --> WS
    RD --> SN
    RD --> ST
    RD --> TR

    CR -->|"tests control plane"| APIS
    WS -->|"tests pods"| KLET
    SN -->|"tests networking"| KPROX
    ST -->|"tests storage"| WorkerVM
    TR -->|"uses logs/events"| APIS
    TR -->|"uses logs/events"| KLET

    %% Click Events
    click Terraform "https://github.com/alijahnas/cka-practice-exercises/blob/CKA-v1.27/terraform/cluster-infra.tf"
    click Containerd "https://github.com/alijahnas/cka-practice-exercises/blob/CKA-v1.27/containerd-install.sh"
    click CR "https://github.com/alijahnas/cka-practice-exercises/blob/CKA-v1.27/cluster-architecture-installation-configuration.md"
    click WS "https://github.com/alijahnas/cka-practice-exercises/blob/CKA-v1.27/workloads-scheduling.md"
    click SN "https://github.com/alijahnas/cka-practice-exercises/blob/CKA-v1.27/services-networking.md"
    click ST "https://github.com/alijahnas/cka-practice-exercises/blob/CKA-v1.27/storage.md"
    click TR "https://github.com/alijahnas/cka-practice-exercises/blob/CKA-v1.27/troubleshooting.md"
    click RD "https://github.com/alijahnas/cka-practice-exercises/blob/CKA-v1.27/README.md"

    %% Styles
    classDef infra fill:#e6ffe6,stroke:#2d7a2d,color:#2d7a2d
    classDef platform fill:#e6f0ff,stroke:#1f4e8c,color:#1f4e8c
    classDef workload fill:#fff2e6,stroke:#c66e00,color:#c66e00
    classDef script fill:#f2f2f2,stroke:#666666,color:#333333
    classDef doc fill:#f2f2f2,stroke:#666666,color:#333333
```
