Skip to content

Commit cb605bb

Browse files
committed
Add Kubernetes deployment configurations and update README instructions
1 parent 5917d41 commit cb605bb

File tree

6 files changed

+159
-9
lines changed

6 files changed

+159
-9
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,22 @@ The `Host name/address`, `Username` and `Password` are specified in `balancer-m
5050

5151
### Prereqs
5252

53-
- Install ([Devbox](https://www.jetify.com/devbox))
53+
- Install [Devbox](https://www.jetify.com/devbox)
54+
- Run the following script with admin privileges:
55+
56+
```bash
57+
HOSTNAME="balancertestsite.com"
58+
DOCKER_IP=$(docker network inspect kind -f '{{(index .IPAM.Config 0).Gateway}}')
59+
echo "Docker IP: $DOCKER_IP"
60+
61+
# Check if the correct line already exists
62+
if grep -q "^$DOCKER_IP[[:space:]]\+$HOSTNAME" /etc/hosts; then
63+
echo "Entry for $HOSTNAME with IP $DOCKER_IP already exists in /etc/hosts"
64+
else
65+
echo "Updating /etc/hosts for $HOSTNAME"
66+
sudo sed -i "/[[:space:]]$HOSTNAME/d" /etc/hosts
67+
echo "$DOCKER_IP $HOSTNAME" | sudo tee -a /etc/hosts
68+
fi
5469

5570
### Steps to reproduce
5671

deploy/kind-config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
kind: Cluster
2+
apiVersion: kind.x-k8s.io/v1alpha4
3+
nodes:
4+
- role: control-plane
5+
extraPortMappings:
6+
- containerPort: 31880
7+
hostPort: 31880
8+
- containerPort: 30219
9+
hostPort: 30219

deploy/manifests/balancer/base/deployment.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ spec:
2424
name: balancer-config
2525
ports:
2626
- containerPort: 8000
27+
readinessProbe:
28+
httpGet:
29+
path: /
30+
port: 8000
31+
initialDelaySeconds: 30
32+
periodSeconds: 10

deploy/manifests/balancer/base/service.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ spec:
88
ports:
99
- name: http
1010
port: 80
11-
targetPort: 8080
11+
targetPort: 8000
1212
selector:
1313
app: balancer

devbox.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
"kubernetes-helm@latest",
77
"kind@latest",
88
"k9s@latest",
9-
"kustomize@latest"
9+
"kustomize@latest",
10+
"jq@latest"
1011
],
1112
"shell": {
1213
"init_hook": [
1314
"echo 'Welcome to devbox!' > /dev/null"
1415
],
1516
"scripts": {
1617
"create:cluster": [
17-
"kind create cluster --name devbox --wait 60s",
18+
"kind create cluster --name devbox --wait 60s --config ./deploy/kind-config.yml",
1819
"kubectl cluster-info"
1920
],
2021
"deploy:balancer": [
@@ -27,18 +28,21 @@
2728
],
2829
"install:balancer": [
2930
"kubectl create namespace balancer || true",
30-
"kubectl apply -k ./deploy/manifests/balancer/overlays/dev"
31+
"kubectl apply -k ./deploy/manifests/balancer/overlays/dev",
32+
"echo 'Balancer deployed successfully!'",
33+
"echo 'You can access the balancer site at:'",
34+
"echo \"HTTPS: https://balancertestsite.com:$(kubectl get svc -n ingress-nginx -o json ingress-nginx-controller | jq .spec.ports[1].nodePort)\""
3135
],
3236
"install:cert-manager": [
3337
"helm repo add jetstack https://charts.jetstack.io || true",
34-
"helm repo update",
35-
"helm upgrade --install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true",
38+
"helm repo update jetstack",
39+
"helm upgrade --install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set crds.enabled=true",
3640
"kubectl apply -f ./deploy/manifests/cert-manager"
3741
],
3842
"install:ingress-nginx": [
3943
"helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx || true",
40-
"helm repo update",
41-
"helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --create-namespace",
44+
"helm repo update ingress-nginx",
45+
"helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --create-namespace --set controller.service.nodePorts.http=31880 --set controller.service.nodePorts.https=30219",
4246
"kubectl wait --namespace ingress-nginx --for=condition=Available deployment/ingress-nginx-controller --timeout=120s"
4347
]
4448
}

devbox.lock

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,122 @@
5353
"last_modified": "2025-06-20T02:24:11Z",
5454
"resolved": "github:NixOS/nixpkgs/076e8c6678d8c54204abcb4b1b14c366835a58bb?lastModified=1750386251&narHash=sha256-1ovgdmuDYVo5OUC5NzdF%2BV4zx2uT8RtsgZahxidBTyw%3D"
5555
},
56+
"jq@latest": {
57+
"last_modified": "2025-06-25T15:38:15Z",
58+
"resolved": "github:NixOS/nixpkgs/61c0f513911459945e2cb8bf333dc849f1b976ff#jq",
59+
"source": "devbox-search",
60+
"version": "1.8.0",
61+
"systems": {
62+
"aarch64-darwin": {
63+
"outputs": [
64+
{
65+
"name": "bin",
66+
"path": "/nix/store/04gj0cpc6mv0pkyz114p23fq65zx8mbx-jq-1.8.0-bin",
67+
"default": true
68+
},
69+
{
70+
"name": "man",
71+
"path": "/nix/store/7zdrvbyc5pgq9by1wzpn0q28iqsd0lx7-jq-1.8.0-man",
72+
"default": true
73+
},
74+
{
75+
"name": "dev",
76+
"path": "/nix/store/glkhwajjprqny359z1awxll8vnsa66lf-jq-1.8.0-dev"
77+
},
78+
{
79+
"name": "doc",
80+
"path": "/nix/store/yygyqari7g4kz9j0yyyl2lq6v2bg3dw2-jq-1.8.0-doc"
81+
},
82+
{
83+
"name": "out",
84+
"path": "/nix/store/78wqqi0zdlrgadz3nmd909axh5182k7v-jq-1.8.0"
85+
}
86+
],
87+
"store_path": "/nix/store/04gj0cpc6mv0pkyz114p23fq65zx8mbx-jq-1.8.0-bin"
88+
},
89+
"aarch64-linux": {
90+
"outputs": [
91+
{
92+
"name": "bin",
93+
"path": "/nix/store/k9mybm2b3yr0v9fsm8vi0319diai4flj-jq-1.8.0-bin",
94+
"default": true
95+
},
96+
{
97+
"name": "man",
98+
"path": "/nix/store/v8lgx3i8v7kjqzgs8x75v0ysrlylfhg1-jq-1.8.0-man",
99+
"default": true
100+
},
101+
{
102+
"name": "dev",
103+
"path": "/nix/store/rzzhwmzryil6g7pl5i7jb4fs54nkkrm4-jq-1.8.0-dev"
104+
},
105+
{
106+
"name": "doc",
107+
"path": "/nix/store/xjcyd1pjjzja918407x5hvsa6sa3k4mj-jq-1.8.0-doc"
108+
},
109+
{
110+
"name": "out",
111+
"path": "/nix/store/8p4cdklsb5kn1w4ycq9na07ja19j6d87-jq-1.8.0"
112+
}
113+
],
114+
"store_path": "/nix/store/k9mybm2b3yr0v9fsm8vi0319diai4flj-jq-1.8.0-bin"
115+
},
116+
"x86_64-darwin": {
117+
"outputs": [
118+
{
119+
"name": "bin",
120+
"path": "/nix/store/4d5y298s33gi9vcvviq8xah06203395s-jq-1.8.0-bin",
121+
"default": true
122+
},
123+
{
124+
"name": "man",
125+
"path": "/nix/store/drgz0ky78p3c6raccn7xsb5m9f91ba3x-jq-1.8.0-man",
126+
"default": true
127+
},
128+
{
129+
"name": "doc",
130+
"path": "/nix/store/0122gf5v7922213mkjp3vlij53fkqvir-jq-1.8.0-doc"
131+
},
132+
{
133+
"name": "out",
134+
"path": "/nix/store/akq414spg0yr5rdba7mbbvz8s945gmya-jq-1.8.0"
135+
},
136+
{
137+
"name": "dev",
138+
"path": "/nix/store/zsmngm14i76pv54z4n8sj7dcwy6x10kn-jq-1.8.0-dev"
139+
}
140+
],
141+
"store_path": "/nix/store/4d5y298s33gi9vcvviq8xah06203395s-jq-1.8.0-bin"
142+
},
143+
"x86_64-linux": {
144+
"outputs": [
145+
{
146+
"name": "bin",
147+
"path": "/nix/store/2n9hfcfqdszxgsmi4qyqq6rv947dwwg9-jq-1.8.0-bin",
148+
"default": true
149+
},
150+
{
151+
"name": "man",
152+
"path": "/nix/store/njrgxwqnifcyh3x0v18v83ig179zccx0-jq-1.8.0-man",
153+
"default": true
154+
},
155+
{
156+
"name": "out",
157+
"path": "/nix/store/qqx05qwhhmbrviw3iskgaigjxhczqhvx-jq-1.8.0"
158+
},
159+
{
160+
"name": "dev",
161+
"path": "/nix/store/dvy119mx8ab0yjxblaaippb2js6nbzkn-jq-1.8.0-dev"
162+
},
163+
{
164+
"name": "doc",
165+
"path": "/nix/store/5qly4lwxrq5r3x472g2w35rz50b54a6n-jq-1.8.0-doc"
166+
}
167+
],
168+
"store_path": "/nix/store/2n9hfcfqdszxgsmi4qyqq6rv947dwwg9-jq-1.8.0-bin"
169+
}
170+
}
171+
},
56172
"k9s@latest": {
57173
"last_modified": "2025-06-01T15:36:18Z",
58174
"resolved": "github:NixOS/nixpkgs/5929de975bcf4c7c8d8b5ca65c8cd9ef9e44523e#k9s",

0 commit comments

Comments
 (0)