Skip to content

Commit ce33292

Browse files
committed
Add MetalLB setup and TensorFlow Dockerfile for local Kubernetes cluster
- Introduce MetalLB manifests, address pool, and configuration script in `infra/local/tf`. - Add TensorFlow-based `Dockerfile` in `infra/local/tf` for GPU-enabled environment. - Update `.gitignore` to exclude `config-kind-in-container`. - Adjust `docker-compose.yml` to include `tf-bastion` service with necessary mounts and configurations.
1 parent 1bac559 commit ce33292

5 files changed

Lines changed: 65 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.idea
22
**/.gcp/**/*.json
33
*.terraform*
4-
*tfstate*
4+
*tfstate*
5+
6+
*config-kind-in-container*

infra/local/external_workloads/docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ services:
2222
networks:
2323
- kind
2424

25+
tf-bastion:
26+
image: gregogs/cuda:workers-v1.0
27+
container_name: tf-bastion-external
28+
extra_hosts:
29+
- "host.docker.internal:host-gateway"
30+
volumes:
31+
- ../../../workloads:/workloads:rw
32+
- ../mysql-database:/data:ro
33+
- ../tf/config-kind-in-container:/root/.kube/config:ro
34+
environment:
35+
- KUBECONFIG=/root/.kube/config
36+
command: [ "bash", "-lc", "sleep infinity" ]
37+
networks:
38+
- kind
39+
2540
networks:
2641
kind:
2742
external: true

infra/local/tf/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM tensorflow/tensorflow:latest-gpu
2+
LABEL authors="greg-ogs"
3+
4+
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg
5+
6+
RUN curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.34/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
7+
8+
RUN chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg && \
9+
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.34/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list && \
10+
chmod 644 /etc/apt/sources.list.d/kubernetes.list
11+
12+
RUN apt-get update && apt-get install -y kubectl
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: metallb.io/v1beta1
2+
kind: IPAddressPool
3+
metadata:
4+
name: lb-pool
5+
namespace: metallb-system
6+
spec:
7+
addresses:
8+
- 172.18.255.200-172.18.255.250
9+
---
10+
apiVersion: metallb.io/v1beta1
11+
kind: L2Advertisement
12+
metadata:
13+
name: lb-adv
14+
namespace: metallb-system

infra/local/tf/metallb.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env sh
2+
3+
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.15.2/config/manifests/metallb-native.yaml
4+
5+
kubectl -n metallb-system wait deploy --all --for=condition=Available --timeout=120s
6+
7+
docker network inspect kind --format '{{json .IPAM.Config}}'
8+
9+
kubectl apply -f ./infra/local/tf/metallb-adreess-pool.yaml
10+
11+
# For the container kubectl using kind
12+
13+
# Powershell
14+
#$src = "$env:USERPROFILE\.kube\config"
15+
#$dst = "$env:USERPROFILE\.kube\config-kind-in-container"
16+
#Copy-Item $src $dst -Force
17+
18+
#(Get-Content $dst) -replace 'https://127\.0\.0\.1:(\d+)', 'https://desktop-control-plane:$1' | Set-Content $dst
19+
20+
cp ~/.kube/config ~/.kube/config-kind-in-container
21+
sed -i -E 's#https://127\.0\.0\.1:([0-9]+)#https://desktop-control-plane:\1#g' ~/.kube/config-kind-in-container

0 commit comments

Comments
 (0)