Skip to content

Commit

Permalink
Update Kubernetes configurations: modify YAML validation paths, enhan…
Browse files Browse the repository at this point in the history
…ce documentation, and introduce Keepalived resources for proxy server.
  • Loading branch information
EliasDeHondt committed Dec 21, 2024
1 parent e1f2a7f commit 4bd6419
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
# Step 3
- name: Validate Kubernetes YAML
run: |
# Test all YAML files under 'Supercluster/' for syntax errors
for file in $(find supercluster -name '*.yaml'); do
# Test all YAML files under 'Cluster01/' for syntax errors
for file in $(find cluster01 -name '*.yaml'); do
echo "Validating $file"
kubectl apply --dry-run=client -f $file
done
24 changes: 12 additions & 12 deletions Documentation/Create-HA-K8s-Cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,18 @@ sudo shutdown -h now

> **Note:** Assuming you did this in a virtual machine, you can convert it to a template and then, create a few instances. e.g. node01, node02, node03, ...
| ID | Name | Roll | IP | CPU | RAM | Disk | OS | Type |
|-----|--------|-------------|---------------| --- | ----- | ---- | -----------------| ---- |
| 170 | proxy1 | Proxy | 192.168.1.170 | 1 | 0.5GB | 8GB | Ubuntu 24.04 LTS | CT |
| 171 | node01 | Master | 192.168.1.171 | 2 | 2GB | 32GB | Ubuntu 24.04 LTS | VM |
| 172 | node02 | Master | 192.168.1.172 | 2 | 2GB | 32GB | Ubuntu 24.04 LTS | VM |
| 173 | node03 | Master | 192.168.1.173 | 2 | 2GB | 32GB | Ubuntu 24.04 LTS | VM |
| 174 | node04 | Worker | 192.168.1.174 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 175 | node05 | Worker | 192.168.1.175 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 176 | node06 | Worker | 192.168.1.176 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 177 | node07 | Worker | 192.168.1.177 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 178 | node08 | Worker | 192.168.1.178 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 179 | node09 | Worker | 192.168.1.179 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| ID | Name | Roll | IP | CPU | RAM | Disk | OS | Type |
| --- | ------ | ------ | ------------- | --- | ----- | ---- | -----------------| ---- |
| 170 | proxy1 | Proxy | 192.168.1.170 | 1 | 0.5GB | 8GB | Ubuntu 24.04 LTS | CT |
| 171 | node01 | Master | 192.168.1.171 | 2 | 2GB | 32GB | Ubuntu 24.04 LTS | VM |
| 172 | node02 | Master | 192.168.1.172 | 2 | 2GB | 32GB | Ubuntu 24.04 LTS | VM |
| 173 | node03 | Master | 192.168.1.173 | 2 | 2GB | 32GB | Ubuntu 24.04 LTS | VM |
| 174 | node04 | Worker | 192.168.1.174 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 175 | node05 | Worker | 192.168.1.175 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 176 | node06 | Worker | 192.168.1.176 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 177 | node07 | Worker | 192.168.1.177 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 178 | node08 | Worker | 192.168.1.178 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |
| 179 | node09 | Worker | 192.168.1.179 | 2 | 4GB | 32GB | Ubuntu 24.04 LTS | VM |

### 👉Step 4: Set up reverse/forward proxy

Expand Down
65 changes: 58 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
1. [📘Table of Contents](#📘table-of-contents)
2. [🖖Introduction](#🖖introduction)
3. [📚Documentation](#📚documentation)
4. [🔗Links](#🔗links)
4. [🌌Supercluster Design](#🌌supercluster-design)
1. [🌌Cluster 01](#🌌cluster-01)
2. [🌌Cluster 02](#🌌cluster-02)
3. [🌌Cluster 03](#🌌cluster-03)
5. [🔗Links](#🔗links)

---

Expand All @@ -21,13 +25,60 @@ Please also see following documents:

## 📚Documentation

- Clone the repository to your local machine using the following command:
```bash
git clone https://github.com/EliasDH-com/K8s-Infrastructure.git
cd K8s-Infrastructure
```
- [Cert-manager-and-nginx-ingress.md](/Documentation/Cert-manager-and-nginx-ingress.md)
- [Create-HA-K8s-Cluster.md](/Documentation/Create-HA-K8s-Cluster.md)
- [Install-K9s-Tool.md](/Documentation/Install-K9s-Tool.md)
- [Install-Longhorn.md](/Documentation/Install-Longhorn.md)

> **Note:** Also, an interesting repository is: [Documentation](https://github.com/EliasDH-com/Documentation).
## 🌌Supercluster Design

### 🌌Cluster 01

- Nodes:
| ID | Name | Cluster | Roll | IP | CPU | RAM | Disk | OS |
| --- | ------- | --------- | ------- | --------- | --- | ----- | -----| -----------------|
| 001 | node01 | cluster01 | Master | 10.1.0.1 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 002 | node02 | cluster01 | Master | 10.1.0.2 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 003 | node03 | cluster01 | Master | 10.1.0.3 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 004 | node04 | cluster01 | Worker | 10.1.0.4 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 005 | node05 | cluster01 | Worker | 10.1.0.5 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 006 | node06 | cluster01 | Worker | 10.1.0.6 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 007 | node07 | cluster01 | Worker | 10.1.0.7 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 008 | node08 | cluster01 | Worker | 10.1.0.8 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 009 | node09 | cluster01 | Worker | 10.1.0.9 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 010 | proxy01 | cluster01 | Worker | 10.1.0.10 | 1 | 1GB | 0KB | Ubuntu 24.04 LTS |

### 🌌Cluster 02

- Nodes:
| ID | Name | Cluster | Roll | IP | CPU | RAM | Disk | OS |
| --- | ------- | --------- | ------- | --------- | --- | ----- | -----| -----------------|
| 011 | node11 | cluster02 | Master | 10.2.0.1 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 012 | node12 | cluster02 | Master | 10.2.0.2 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 013 | node13 | cluster02 | Master | 10.2.0.3 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 014 | node14 | cluster02 | Worker | 10.2.0.4 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 015 | node15 | cluster02 | Worker | 10.2.0.5 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 016 | node16 | cluster02 | Worker | 10.2.0.6 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 017 | node17 | cluster02 | Worker | 10.2.0.7 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 018 | node18 | cluster02 | Worker | 10.2.0.8 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 019 | node19 | cluster02 | Worker | 10.2.0.9 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 020 | proxy02 | cluster02 | Worker | 10.2.0.10 | 1 | 1GB | 0KB | Ubuntu 24.04 LTS |

### 🌌Cluster 03

- Nodes:
| ID | Name | Cluster | Roll | IP | CPU | RAM | Disk | OS |
| --- | ------- | --------- | ------- | --------- | --- | ----- | -----| -----------------|
| 021 | node31 | cluster03 | Master | 10.3.0.1 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 022 | node32 | cluster03 | Master | 10.3.0.2 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 023 | node33 | cluster03 | Master | 10.3.0.3 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 024 | node34 | cluster03 | Worker | 10.3.0.4 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 025 | node35 | cluster03 | Worker | 10.3.0.5 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 026 | node36 | cluster03 | Worker | 10.3.0.6 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 027 | node37 | cluster03 | Worker | 10.3.0.7 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 028 | node38 | cluster03 | Worker | 10.3.0.8 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 029 | node39 | cluster03 | Worker | 10.3.0.9 | 16 | 64GB | 8TB | Ubuntu 24.04 LTS |
| 030 | proxy03 | cluster03 | Worker | 10.3.0.10 | 1 | 1GB | 0KB | Ubuntu 24.04 LTS |

## 🔗Links
- 👯 Web hosting company [EliasDH.com](https://eliasdh.com).
Expand Down
16 changes: 14 additions & 2 deletions Supercluster/Cluster01/Metallb/IPAddressPool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@
# @since 24/11/2024 #
############################
---
# This is the default address pool.
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: address-pool-1
namespace: metallb-system
spec:
addresses:
- 192.168.1.160-192.168.1.169
- 192.168.1.200-192.168.1.250 # 50 addresses.
---
# This is a static ip address for PiHole (DNS).
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: static-ip-1
namespace: metallb-system
spec:
addresses:
- 192.168.1.120-192.168.1.120
- 192.168.1.120/32 # 1 address.
---
# This is a static IP address for the proxy that is used for accessing the master nodes.
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: static-ip-2
namespace: metallb-system
spec:
addresses:
- 192.168.1.170/32 # 1 address.
---
3 changes: 2 additions & 1 deletion Supercluster/Cluster01/Metallb/L2Advertisement.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: l2advertisement-1
name: l2advertisement
namespace: metallb-system
spec:
ipAddressPools:
- address-pool-1
- static-ip-1
- static-ip-2
---
45 changes: 45 additions & 0 deletions Supercluster/Cluster01/ProxyServer1/Keepalived/ConfigMap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
############################
# @author Elias De Hondt #
# @see https://eliasdh.com #
# @since 24/11/2024 #
############################
---
apiVersion: v1
kind: ConfigMap
metadata:
name: proxyserver1-keepalived-config
namespace: proxyserver1
data:
keepalived.conf: |
global_defs {
router_id proxy1
script_user root
script_security 1
}
vrrp_script check_apiserver {
script "/etc/keepalived/check_apiserver.sh"
interval 3
weight -2
fall 10
rise 2
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 101
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.1.170
}
track_script {
check_apiserver
}
}
---
33 changes: 33 additions & 0 deletions Supercluster/Cluster01/ProxyServer1/Keepalived/Deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
############################
# @author Elias De Hondt #
# @see https://eliasdh.com #
# @since 24/11/2024 #
############################
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: proxyserver1-keepalived-deployment
namespace: proxyserver1
spec:
replicas: 1
selector:
matchLabels:
app: proxyserver1-keepalived-deployment
template:
metadata:
labels:
app: proxyserver1-keepalived-deployment
spec:
containers:
- name: proxyserver1-keepalived-container
image: osixia/keepalived:latest
volumeMounts:
- name: proxyserver1-keepalived-config
mountPath: /etc/keepalived/keepalived.conf
subPath: keepalived.conf
volumes:
- name: proxyserver1-keepalived-config
configMap:
name: proxyserver1-keepalived-config
---
19 changes: 19 additions & 0 deletions Supercluster/Cluster01/ProxyServer1/Namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
############################
# @author Elias De Hondt #
# @see https://eliasdh.com #
# @since 24/11/2024 #
############################
---
apiVersion: v1
kind: Namespace
metadata:
name: proxyserver1
labels:
name: proxyserver1
app: proxyserver1
owner: EliasDH
environment: production
annotations:
description: This namespace is used for the proxyserver1 application.
contact: info@eliasdh.com
---

0 comments on commit 4bd6419

Please sign in to comment.