Add docs.
This commit is contained in:
69
docs/prompt.md
Normal file
69
docs/prompt.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# K3s Kubernetes Infrastructure Generation Prompt
|
||||
|
||||
This document contains the prompt that can be used to regenerate the entire K3s Kubernetes infrastructure project based on the PlantUML diagrams provided in this directory.
|
||||
|
||||
## Prompt for Project Generation
|
||||
|
||||
```
|
||||
Please generate a complete Terraform project for deploying a K3s Kubernetes cluster based on the following PlantUML diagrams:
|
||||
|
||||
1. The activity diagram (k3s_infrastructure_activity_diagram.puml) shows the workflow and sequence of operations for setting up the K3s infrastructure.
|
||||
2. The component diagram (k3s_component_diagram.puml) illustrates the main components and their relationships.
|
||||
3. The sequence diagram (k3s_sequence_diagram.puml) details the interaction between different components during deployment.
|
||||
4. The deployment diagram (k3s_deployment_diagram.puml) shows the physical architecture of the Kubernetes cluster.
|
||||
5. The class diagram (k3s_class_diagram.puml) depicts the relationships between Terraform resources.
|
||||
|
||||
Based on these diagrams, create a complete Terraform project with the following structure:
|
||||
|
||||
- terraform/
|
||||
- modules/
|
||||
- k3s-install/
|
||||
- main.tf (K3s installation logic)
|
||||
- variables.tf (Module variables)
|
||||
- outputs.tf (Module outputs)
|
||||
- infra/
|
||||
- dev/
|
||||
- main.tf (Main entry point)
|
||||
- variables.tf (Variable definitions)
|
||||
- terraform.tfvars (Variable values)
|
||||
- env.tf (Environment file handling)
|
||||
- providers.tf (Provider configurations)
|
||||
- .env (Environment variables - empty template)
|
||||
|
||||
The project should implement the following functionality:
|
||||
1. Setup SSH configuration for secure connections to server and worker nodes
|
||||
2. Install K3s server on the main node
|
||||
3. Retrieve kubeconfig and node token from the server
|
||||
4. Copy the node token to worker nodes
|
||||
5. Install K3s agents on worker nodes
|
||||
6. Provide proper cleanup/uninstallation on terraform destroy
|
||||
7. Handle any potential errors gracefully
|
||||
|
||||
Use only null and local providers for this infrastructure. All operations should be performed using SSH connections and local-exec/remote-exec provisioners.
|
||||
|
||||
Please implement each file with complete, working code that follows Terraform best practices.
|
||||
```
|
||||
|
||||
## Modifying the Infrastructure
|
||||
|
||||
To modify the infrastructure, you can:
|
||||
|
||||
1. Edit the PlantUML diagrams to reflect your desired changes
|
||||
2. Provide a prompt like the following:
|
||||
|
||||
```
|
||||
Based on the modified PlantUML diagram [diagram_name.puml], please update the corresponding Terraform files to implement these changes:
|
||||
|
||||
[List specific changes here]
|
||||
|
||||
Ensure that the changes maintain the overall integrity of the infrastructure and follow Terraform best practices.
|
||||
```
|
||||
|
||||
## Additional Considerations
|
||||
|
||||
- The diagrams contain detailed comments and notes that explain the functionality and purpose of each component
|
||||
- The activity diagram shows the exact flow of operations needed for proper deployment
|
||||
- The class diagram maps directly to Terraform resources and their relationships
|
||||
- The sequence diagram provides timing information critical for understanding dependencies
|
||||
|
||||
By following these diagrams, you can generate a fully functional Terraform project for deploying a K3s Kubernetes cluster on any compatible infrastructure.
|
||||
Reference in New Issue
Block a user