From 7f866655774af4f96df2fc413e969b37bbfb0ed9 Mon Sep 17 00:00:00 2001 From: baschno Date: Tue, 3 Dec 2024 07:27:45 +0100 Subject: [PATCH 1/3] state of the doing --- 01_metallb_config.yml | 14 ++------------ 02_traefik_values.yml | 2 +- 03_default_headers.yml | 2 +- 04_secret_dashboard.yml | 2 +- Metallb_Setup/03_advertisement.yaml | 2 +- README.md | 14 ++++++++++++++ 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/01_metallb_config.yml b/01_metallb_config.yml index f70a926..8dffdd7 100644 --- a/01_metallb_config.yml +++ b/01_metallb_config.yml @@ -3,18 +3,8 @@ apiVersion: metallb.io/v1beta1 kind: IPAddressPool metadata: name: cluster-pool - namespace: metallb + namespace: metallb-system spec: addresses: - - 192.168.178.230-192.168.178.250 + - 192.168.178.220-192.168.178.250 ---- -# L2 configuration -apiVersion: metallb.io/v1beta1 -kind: L2Advertisement -metadata: - name: metallb-homelab - namespace: metallb -spec: - ipAddressPools: - - cluster-pool \ No newline at end of file diff --git a/02_traefik_values.yml b/02_traefik_values.yml index 914c2bb..2b7de62 100644 --- a/02_traefik_values.yml +++ b/02_traefik_values.yml @@ -47,6 +47,6 @@ service: annotations: {} labels: {} spec: - loadBalancerIP: 192.168.178.231 # IP in the MetalLB range from metallb config.yaml + loadBalancerIP: 192.168.178.220 # IP in the MetalLB range from metallb config.yaml loadBalancerSourceRanges: [] externalIPs: [] \ No newline at end of file diff --git a/03_default_headers.yml b/03_default_headers.yml index 3c318da..dcb6cb5 100644 --- a/03_default_headers.yml +++ b/03_default_headers.yml @@ -1,4 +1,4 @@ -apiVersion: traefik.containo.us/v1alpha1 +apiVersion: traefik.traefik.io/v1alpha1 kind: Middleware metadata: name: default-headers diff --git a/04_secret_dashboard.yml b/04_secret_dashboard.yml index 3fb5105..ea9763e 100644 --- a/04_secret_dashboard.yml +++ b/04_secret_dashboard.yml @@ -6,4 +6,4 @@ metadata: namespace: traefik type: Opaque data: - users: cG9wZTokYXByMSRCNTVxbUFoWSRLS3BDVmJvUUd5VTFnOVg4WVpiUXAvCgo= \ No newline at end of file + users: YmFzdGk6JGFwcjEkR0xuMHNBeW4kUlVPYWpTSHo4UHg4eGhvZDM0M3dHMAoK \ No newline at end of file diff --git a/Metallb_Setup/03_advertisement.yaml b/Metallb_Setup/03_advertisement.yaml index 9811432..c8a35e9 100644 --- a/Metallb_Setup/03_advertisement.yaml +++ b/Metallb_Setup/03_advertisement.yaml @@ -6,4 +6,4 @@ metadata: # can be left out, then all available addresspools will be bound spec: ipAddressPools: - - fdefault-address-pool \ No newline at end of file + - cluster-pool \ No newline at end of file diff --git a/README.md b/README.md index 95bebc1..9ae6194 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ Current Setup +01 Metallb +Define IP Pool & L2 config + +https://metallb.universe.tf/configuration/ + + + https://ryan-pope.com/posts/Homelab-to-k3s/ https://blog.chicho.com.ar/how-to-deploy-a-kubernetes-cluster-with-k3s/ @@ -7,3 +14,10 @@ https://blog.chicho.com.ar/how-to-deploy-a-kubernetes-cluster-with-k3s/ https://picluster.ricsanfre.com/docs/traefik/ https://k3s.rocks/metrics/ + + +``` +kubectl create namespace dishes +kubectl create deploy schnipo --image=bschnorbus/dish-schnipo -n dishes +kubectl expose deploy schnipo --port=80 --target-port=8080 --type=LoadBalancer -n dishes +``` \ No newline at end of file From 521041edc0e3fe3acea6190b11bb354a6ec2de6e Mon Sep 17 00:00:00 2001 From: baschno Date: Tue, 3 Dec 2024 07:28:24 +0100 Subject: [PATCH 2/3] dem lempa sei tutorial --- traefik_lempa/nginx-ingress.yaml | 20 ++++++++++++++++++++ traefik_lempa/traefik-values.yaml | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 traefik_lempa/nginx-ingress.yaml create mode 100644 traefik_lempa/traefik-values.yaml diff --git a/traefik_lempa/nginx-ingress.yaml b/traefik_lempa/nginx-ingress.yaml new file mode 100644 index 0000000..b3662ee --- /dev/null +++ b/traefik_lempa/nginx-ingress.yaml @@ -0,0 +1,20 @@ +apiVersion: networking.k8s.io/v1 +kind: ingress +metadata: + name: nginx-ingress + namespace: nginx + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: websecure +spec: + rules: + - host: nginx.internal.schnrbs.work + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: nginx + port: + number: 80 + diff --git a/traefik_lempa/traefik-values.yaml b/traefik_lempa/traefik-values.yaml new file mode 100644 index 0000000..e691287 --- /dev/null +++ b/traefik_lempa/traefik-values.yaml @@ -0,0 +1,5 @@ +ports: + web: + redirectTo: + port: websecure + \ No newline at end of file From a92927f48150e045c1137fe6567a965c402ce913 Mon Sep 17 00:00:00 2001 From: baschno Date: Sat, 21 Dec 2024 16:22:57 +0100 Subject: [PATCH 3/3] wip thing --- Metallb_Setup/02_address_pool.yaml | 2 +- Metallb_Setup/03_advertisement.yaml | 2 +- README.md | 21 +++++++++++++++++++++ traefik_lempa/nginx-ingress.yaml | 7 +++---- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Metallb_Setup/02_address_pool.yaml b/Metallb_Setup/02_address_pool.yaml index 2561f19..3c65847 100644 --- a/Metallb_Setup/02_address_pool.yaml +++ b/Metallb_Setup/02_address_pool.yaml @@ -5,4 +5,4 @@ metadata: namespace: metallb-system spec: addresses: - - 192.168.178.230-192.168.178.250 + - 192.168.178.220-192.168.178.250 diff --git a/Metallb_Setup/03_advertisement.yaml b/Metallb_Setup/03_advertisement.yaml index c8a35e9..aa27af3 100644 --- a/Metallb_Setup/03_advertisement.yaml +++ b/Metallb_Setup/03_advertisement.yaml @@ -6,4 +6,4 @@ metadata: # can be left out, then all available addresspools will be bound spec: ipAddressPools: - - cluster-pool \ No newline at end of file + - default-address-pool \ No newline at end of file diff --git a/README.md b/README.md index 9ae6194..7b9d3c7 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,25 @@ https://k3s.rocks/metrics/ kubectl create namespace dishes kubectl create deploy schnipo --image=bschnorbus/dish-schnipo -n dishes kubectl expose deploy schnipo --port=80 --target-port=8080 --type=LoadBalancer -n dishes +``` + + +## Load Balancer Test w/ Nginx Deployment + +``` +#Create deploy +kubectl create deploy nginx --image=nginx + +kubectl scale --replicas=3 deployment/nginx -n test + +k create svc -n test clusterip nginx --tcp=80 + +#Expose the deploy as a LoadBalancer type +kubectl expose deploy nginx --port=80 --target-port=80 --type=LoadBalancer + +#Verify +kubectl get svc nginx +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +nginx LoadBalancer 10.43.60.115 192.168.52.30 80:32676/TCP 5h19m + ``` \ No newline at end of file diff --git a/traefik_lempa/nginx-ingress.yaml b/traefik_lempa/nginx-ingress.yaml index b3662ee..8ab08bf 100644 --- a/traefik_lempa/nginx-ingress.yaml +++ b/traefik_lempa/nginx-ingress.yaml @@ -1,13 +1,13 @@ apiVersion: networking.k8s.io/v1 -kind: ingress +kind: Ingress metadata: name: nginx-ingress - namespace: nginx + namespace: test annotations: traefik.ingress.kubernetes.io/router.entrypoints: websecure spec: rules: - - host: nginx.internal.schnrbs.work + - host: nginx.k8s.internal.schnrbs.work http: paths: - path: / @@ -17,4 +17,3 @@ spec: name: nginx port: number: 80 -