How mgaydash/k8s-terraria-server works
Main Components
• Helm Chart: Acts as the packaging and deployment mechanism.
• Kubernetes Cluster: The environment where the chart is deployed.
• Deployment Component: Represented by the "deployment-terraria.yaml" template, which defines how the Terraria server pods are created and managed.
• Service Component: Defined in "service-terraria.yaml", this provides access to the running Terraria server.
• Ingress: Defined in "ingress.yaml", handling external HTTP/s routing, if enabled.
• Storage: The "pvc-terraria-data.yaml" template indicates that a Persistent Volume Claim is used for server data storage.
• Secrets: The "secret.yaml" template ensures sensitive information is stored securely.
• Backup Mechanism: The "cronjob-terraria-backup.yaml" template shows that scheduled backups are set up using Kubernetes CronJobs.
• Configuration Files & Scripts: The "files/serverconfig.txt" for server-specific settings and "install.sh" for running the installation.
Relationships and Interactions
• The Helm chart orchestrates the creation of all Kubernetes resources.
• The Deployment creates and manages the Terraria server pods, which mount the PVC for persistent storage.
• The Service exposes the Terraria server internally (and potentially externally, via the Ingress).
• The Secret resource is linked to the Deployment to securely provide sensitive configuration data.
• The CronJob periodically triggers backups, likely interfacing with the same storage (PVC) to secure critical data.
• The Ingress routes external traffic to the Service, ensuring accessibility from outside of the Kubernetes cluster.
Architectural Patterns and Design Principles
• Infrastructure as Code: The use of Helm templating means that your Kubernetes resources are defined in code and can be templated and versioned.
• Modular Design: Each template (deployment, service, PVC, secret, cronjob, ingress) forms a distinct component, which is a best practice for separating concerns.
• Declarative Configuration: Everything is declaratively defined, following GitOps principles.