120 lines
3.2 KiB
Plaintext
120 lines
3.2 KiB
Plaintext
@startuml K3s Infrastructure Class Diagram
|
|
skinparam classAttributeIconSize 0
|
|
|
|
title K3s Kubernetes Cluster - Terraform Resource Relationships
|
|
|
|
package "Terraform Infrastructure" {
|
|
class "Development Environment" as dev {
|
|
+ server_ip: string
|
|
+ worker_ips: list(string)
|
|
+ ssh_user: string
|
|
+ ssh_private_key: string
|
|
+ replace_url: string
|
|
+ domain: string
|
|
+ ssl_cert_path: string
|
|
+ ssl_key_path: string
|
|
+ install_argocd: bool
|
|
+ enable_traefik_dashboard: bool
|
|
+ enable_ssh_tunnel: bool
|
|
}
|
|
|
|
class "K3s Install Module" as k3s_module {
|
|
+ server_ip: string
|
|
+ worker_ips: list(string)
|
|
+ ssh_user: string
|
|
+ ssh_private_key: string
|
|
+ replace_url: string
|
|
+ apply()
|
|
+ destroy()
|
|
}
|
|
|
|
class "null_resource.setup_ssh_config" as ssh_config {
|
|
+ triggers: map
|
|
- local-exec: create SSH config
|
|
}
|
|
|
|
class "null_resource.install_k3s_server" as server_install {
|
|
+ depends_on: [setup_ssh_config]
|
|
+ triggers: map
|
|
- remote-exec: install K3s server
|
|
- remote-exec: uninstall on destroy
|
|
}
|
|
|
|
class "null_resource.get_k3s_config" as get_config {
|
|
+ depends_on: [install_k3s_server, setup_ssh_config]
|
|
- remote-exec: copy kubeconfig
|
|
- local-exec: download kubeconfig
|
|
- local-exec: update server URL
|
|
}
|
|
|
|
class "null_resource.get_k3s_token" as get_token {
|
|
+ depends_on: [install_k3s_server, setup_ssh_config]
|
|
- remote-exec: extract node token
|
|
- local-exec: download token
|
|
}
|
|
|
|
class "null_resource.copy_token_to_workers" as copy_token {
|
|
+ depends_on: [get_k3s_token]
|
|
+ count: length(worker_ips)
|
|
- file: upload token to worker
|
|
}
|
|
|
|
class "null_resource.install_k3s_worker" as worker_install {
|
|
+ depends_on: [copy_token_to_workers]
|
|
+ count: length(worker_ips)
|
|
+ triggers: map
|
|
- remote-exec: install K3s agent
|
|
- remote-exec: uninstall on destroy
|
|
}
|
|
|
|
class "Output" as output {
|
|
+ kubeconfig_path: string
|
|
}
|
|
}
|
|
|
|
package "External Resources" {
|
|
class "Server Node" as server {
|
|
+ hostname: string
|
|
+ K3s server
|
|
+ Control plane components
|
|
+ Node token
|
|
+ Kubeconfig
|
|
}
|
|
|
|
class "Worker Node" as worker {
|
|
+ hostname: string
|
|
+ K3s agent
|
|
+ Container runtime
|
|
}
|
|
}
|
|
|
|
dev --> k3s_module : uses
|
|
k3s_module --> ssh_config : creates
|
|
k3s_module --> server_install : creates
|
|
k3s_module --> get_config : creates
|
|
k3s_module --> get_token : creates
|
|
k3s_module --> copy_token : creates
|
|
k3s_module --> worker_install : creates
|
|
k3s_module --> output : provides
|
|
|
|
ssh_config ..> server : configures access
|
|
ssh_config ..> worker : configures access
|
|
server_install ..> server : provisions
|
|
get_config ..> server : extracts config
|
|
get_token ..> server : extracts token
|
|
copy_token ..> worker : transfers token
|
|
worker_install ..> worker : provisions
|
|
|
|
note bottom of k3s_module
|
|
The K3s Install Module orchestrates the provisioning of a K3s Kubernetes cluster
|
|
by creating and managing the necessary resources in sequence:
|
|
1. Set up SSH configuration
|
|
2. Install K3s on server node
|
|
3. Retrieve kubeconfig and node token
|
|
4. Copy token to worker nodes
|
|
5. Install K3s agents on worker nodes
|
|
end note
|
|
|
|
footer K3s Infrastructure Class Diagram - Version 1.0
|
|
@enduml
|