Open7
Proxmox + Terraform(opentofu) + k3sをする
$ k3sup install --ip 192.168.1.31 --user yank
$ k3sup join --ip 192.168.1.32 --server-ip 192.168.1.31 --user yank
$ k3sup join --ip 192.168.1.33 --server-ip 192.168.1.31 --user yank
k3sup
~/infra main* 8s
❯ kubectl get node
NAME STATUS ROLES AGE VERSION
k3s-agent-apollo Ready <none> 57s v1.30.5+k3s1
k3s-agent-raputa Ready <none> 33s v1.30.5+k3s1
k3s-server Ready control-plane,master 5m49s v1.30.5+k3s1
うれしい
resource "proxmox_lxc" "k3s-server" {
target_node = "uneunet-main"
hostname = "k3s-server"
ostemplate = "local:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst"
password = "password"
unprivileged = false
vmid = 100
cores = 4
memory = 4096
swap = 0
rootfs {
storage = "local-lvm"
size = "20G"
}
network {
name = "eno1"
bridge = "vmbr0"
ip = "192.168.1.31/24"
gw = "192.168.1.254"
}
}
resource "proxmox_lxc" "k3s-agent-apollo" {
target_node = "uneunet-main"
hostname = "k3s-agent-apollo"
ostemplate = "local:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst"
password = "password"
unprivileged = false
vmid = 101
cores = 4
memory = 4096
swap = 0
rootfs {
storage = "local-lvm"
size = "20G"
}
network {
name = "eno1"
bridge = "vmbr0"
ip = "192.168.1.32/24"
gw = "192.168.1.254"
}
}
resource "proxmox_lxc" "k3s-agent-raputa" {
target_node = "uneunet-main"
hostname = "k3s-agent-raputa"
ostemplate = "local:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst"
password = "password"
unprivileged = false
vmid = 102
cores = 4
memory = 4096
swap = 0
rootfs {
storage = "local-lvm"
size = "20G"
}
network {
name = "eno1"
bridge = "vmbr0"
ip = "192.168.1.33/24"
gw = "192.168.1.254"
}
}
Terraformはこう
あとは他の記事を参照すると生えます
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 80
nodePort: 30080
selector:
app: nginx
とりあえず192.168.1.31:30080
でnginx確認
Pi-holeとNostrを導入したい