This project enables the creation of a K3s cluster leveraging Oracle Cloud's 'always free' resources. It simplifies the setup process using Terraform and integrates essential tools like Tailscale for secure networking and Cloudflare for DNS management, making it ideal for those wanting to explore K3s without incurring costs.
k3s-oci-always-free is a robust solution for deploying a lightweight Kubernetes cluster using the Oracle Cloud's "always free" resources. This project is designed to provide a streamlined setup for developers and teams looking to leverage Oracle's cloud infrastructure in conjunction with essential tools and services for a seamless application deployment experience.
Features
- Utilizes Oracle Cloud Infrastructure for the compute and network resources, ensuring a reliable backbone for your applications.
- Incorporates Tailscale for a secure mesh VPN connection, facilitating straightforward networking between devices.
- Supports Cloudflare for efficient DNS management, enhancing service reliability and performance.
- Integrates key components such as k3s for lightweight Kubernetes management, helm for package management in Kubernetes, cert-manager for automating TLS certificate issuance, longhorn for persistent storage, and Kubeapps for application management.
Prerequisites
Before deploying, ensure that you have an Oracle Cloud account, a Tailscale account, a Cloudflare account, along with the Terraform CLI and kubectl CLI installed and configured.
Usage Steps
- Prepare your environment by copying the
.env.template
to.env
, and filling in the necessary values. - Load the environment variables by executing
source .env
in your shell. - Initialize the Terraform modules with
terraform init
. - Import your network ACL state using
terraform import module.tailscale.tailscale_acl.cluster_acl acl
. - Deploy the cluster through
terraform apply
, noting that some errors may be expected during the initial setup. - Monitor your nodes to ensure they are registered in the Tailscale network, confirming that
local.is_ready
becomes true. - Deploy the Custom Resource Definitions (CRDs) using Helm with
terraform apply -target module.helm
. - Execute another
terraform apply
to finalize the DNS setup once the Cloudflare records are established.
To manage your Kubernetes configuration securely:
- Fetch the kubectl config using
terraform output fetch_kubeconfig | xargs | sh
. - Merge configurations with
terraform output merge_kubeconfig | xargs | sh
. - Overwrite your local kubeconfig after verifying the merged file contents.
Troubleshooting
Be prepared for common issues, such as:
- Internal Server Errors indicating host capacity issues—retry later when free instances may be available.
- Helm CRD deployment errors, which require you to apply the helm module first for resolution:
terraform apply -target module.helm
. - Tailscale network ACL management adjustments based on your needs, with necessary imports for network ACL states.
Leveraging k3s-oci-always-free allows developers to fully utilize Kubernetes capabilities on Oracle Cloud at no cost, ensuring a feature-rich environment while minimizing operational overhead.
No comments yet.
Sign in to be the first to comment.