Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dezren39 committed Dec 22, 2024
1 parent d2bf1df commit f9db5b0
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 58 deletions.
4 changes: 0 additions & 4 deletions infra/talos/.gitignore

This file was deleted.

24 changes: 0 additions & 24 deletions infra/talos/01b.us-init.sh

This file was deleted.

6 changes: 0 additions & 6 deletions infra/talos/01b.us-load.sh

This file was deleted.

4 changes: 0 additions & 4 deletions infra/talos/01b.us-save.sh

This file was deleted.

20 changes: 0 additions & 20 deletions infra/talos/01b.us.enc

This file was deleted.

2 changes: 2 additions & 0 deletions infra/talos/01b.us/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
secret*
!secrets.enc
8 changes: 8 additions & 0 deletions infra/talos/01b.us/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
investigate talhelper
https://github.com/joeypiccola/k8s_home/tree/main?tab=readme-ov-file#talos-configs

argo/helm setup

use terraform

??? other things ???
74 changes: 74 additions & 0 deletions infra/talos/01b.us/init-cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash
set -ex
if [ -d secrets ]; then
echo "secrets directory already exists"
exit 1
fi
echo "secrets*" >> .gitignore
echo "!secrets.enc" >> .gitignore
mkdir -p secrets
talosctl gen secrets -o ./secrets/secrets.yaml
talosctl gen config --with-secrets ./secrets/secrets.yaml secrets https://10.10.0.42:6443 -o secrets
./save-secrets.sh
cd secrets
talosctl apply-config --insecure --file "./controlplane.yaml" --nodes 10.10.8.188
talosctl apply-config --insecure --file "./controlplane.yaml" --nodes 10.10.15.105
talosctl apply-config --insecure --file "./controlplane.yaml" --nodes 10.10.4.92
talosctl bootstrap --talosconfig=talosconfig --endpoints 10.10.8.188 --nodes 10.10.8.188

# is this right?
talosctl --talosconfig=talosconfig config endpoint 10.10.0.42 10.10.8.188 10.10.15.105 10.10.4.92

talosctl apply-config --insecure --file "./worker.yaml" --nodes 10.10.18.178

# is this right?
talosctl --talosconfig=talosconfig config node 10.10.0.42 10.10.8.188 10.10.15.105 10.10.4.92 10.10.18.178
# talosctl --talosconfig=talosconfig config node 10.10.0.42

talosctl --talosconfig=talosconfig kubeconfig ./kubeconfig -n 10.10.0.42
# talosctl --talosconfig=talosconfig kubeconfig -n 10.10.0.42
kubectl --kubeconfig=kubeconfig get nodes
kubectl --kubeconfig=kubeconfig get nodes -o wide
kubectl --kubeconfig=kubeconfig get deployments
kubectl --kubeconfig=kubeconfig get pods

kubectl --kubeconfig=kubeconfig create deployment hello-world --image=kicbase/echo-server:1.0 --dry-run=client -o yaml | kubectl --kubeconfig=kubeconfig apply -f -
kubectl --kubeconfig=kubeconfig get service hello-world
kubectl --kubeconfig=kubeconfig describe deployment hello-world
kubectl --kubeconfig=kubeconfig describe service hello-world
kubectl --kubeconfig=kubeconfig get service hello-world
kubectl --kubeconfig=kubeconfig expose deployment hello-world --type=LoadBalancer --port=8080
kubectl --kubeconfig=kubeconfig describe deployment hello-world
kubectl --kubeconfig=kubeconfig describe service hello-world
kubectl --kubeconfig=kubeconfig get service hello-world

kubectl --kubeconfig=kubeconfig get nodes -o wide

kubectl --kubeconfig=kubeconfig apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml
kubectl --kubeconfig=kubeconfig -n metallb-system get pods
kubectl --kubeconfig=kubeconfig apply -f ../kubernetes/infrastructure/networking/metallb/config.yaml

kubectl --kubeconfig=kubeconfig get nodes
kubectl --kubeconfig=kubeconfig get nodes -o wide
kubectl --kubeconfig=kubeconfig get deployments
kubectl --kubeconfig=kubeconfig get pods
kubectl --kubeconfig=kubeconfig get nodes -o wide

kubectl --kubeconfig=kubeconfig describe deployment hello-world
kubectl --kubeconfig=kubeconfig describe service hello-world
kubectl --kubeconfig=kubeconfig get service hello-world -o yaml
kubectl --kubeconfig=kubeconfig get service hello-world

EXTERNAL_IP=$(kubectl --kubeconfig=kubeconfig get service hello-world -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

echo "EXTERNAL_IP for hello-world is: $EXTERNAL_IP"

PORTS=$(kubectl --kubeconfig=kubeconfig get service hello-world -o jsonpath='{.spec.ports[*].port}')
echo "PORTS for hello-world are: $PORTS"
for port in $PORTS; do
echo "Curling $EXTERNAL_IP:$port"
curl $EXTERNAL_IP:$port
done

cd ..
./save-secrets.sh
File renamed without changes.
6 changes: 6 additions & 0 deletions infra/talos/01b.us/load-secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
if [ -d secrets ]; then
echo "secrets directory already exists"
exit 1
fi
sops --decrypt secrets.enc | base64 -d | tar xzf -
Empty file.
Empty file.
Empty file added infra/talos/01b.us/patches/TODO
Empty file.
4 changes: 4 additions & 0 deletions infra/talos/01b.us/save-secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
tar czf - ./secrets | base64 > secrets.tmp
sops --encrypt secrets.tmp > secrets.enc
rm secrets.tmp
20 changes: 20 additions & 0 deletions infra/talos/01b.us/secrets.enc

Large diffs are not rendered by default.

0 comments on commit f9db5b0

Please sign in to comment.