add module to create a k8s worker [ci skip]
This commit is contained in:
parent
3547db0a13
commit
90dde34731
6 changed files with 59 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ users:
|
|||
- ${authorized_ssh_key}
|
||||
passwd: ${passwd}
|
||||
lock_passwd: false # enable passwd login
|
||||
shell: /bin/bash
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
packages:
|
||||
|
|
@ -20,3 +21,35 @@ packages:
|
|||
- wget
|
||||
- net-tools
|
||||
- zsh
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- gpg
|
||||
# docker
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
# kubernetes
|
||||
- kubeadm
|
||||
- kubelet
|
||||
|
||||
apt:
|
||||
sources:
|
||||
kubernetes:
|
||||
source: "deb https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /"
|
||||
keyid: "DE15B14486CD377B9E876E1A234654DA9A296436"
|
||||
filename: kubernetes.list
|
||||
docket:
|
||||
source: "deb https://download.docker.com/linux/ubuntu noble stable"
|
||||
keyid: "9DC858229FC7DD38854AE2D88D81803C0EBFCD88"
|
||||
filename: docker.list
|
||||
|
||||
runcmd:
|
||||
- apt-mark hold kubelet kubeadm kubectl
|
||||
- systemctl stop kubelet
|
||||
- containerd config default | sudo tee /etc/containerd/config.toml
|
||||
- systemctl restart containerd
|
||||
- ${k8s_join_command}
|
||||
- systemctl enable kubelet
|
||||
- systemctl start kubelet
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ variable "template_id" {
|
|||
variable "template_name" { type = string }
|
||||
variable "snippet_name" { type = string }
|
||||
variable "user_passwd" { type = string } # hashed pw
|
||||
variable "k8s_join_command" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
# SSH connection to Proxmox
|
||||
resource "null_resource" "create_template_remote" {
|
||||
|
|
@ -56,7 +60,7 @@ resource "null_resource" "upload_cloud_init" {
|
|||
|
||||
provisioner "file" {
|
||||
destination = "/var/lib/vz/snippets/${var.snippet_name}"
|
||||
content = templatefile("${path.module}/cloud_init.yaml", { authorized_ssh_key = file("~/.ssh/id_ed25519.pub"), passwd = var.user_passwd })
|
||||
content = templatefile("${path.module}/cloud_init.yaml", { authorized_ssh_key = file("~/.ssh/id_ed25519.pub"), passwd = var.user_passwd, k8s_join_command = var.k8s_join_command })
|
||||
}
|
||||
|
||||
triggers = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue