Expose your MicroK8s homelab to the Internet
Fork and clone this repository, then navigate to the project root and follow the instructions below.
The pre-commit hook runs formatting and sanity checks such as tofu fmt
to reduce the chance of accidentally submitting badly formatted code that would fail CI.
ln -s ../../hooks/pre-commit ./.git/hooks/pre-commit
If deploying the resources to AWS, you'll need to install and set up AWS CLI v2 with a valid access key and secret key corresponding to an IAM administrator account.
Install the latest version of OpenTofu. The version used is 1.6.1
at the time of writing (2024-02-10).
You'll also need an SSH key pair for remoting into your instance - generate this with ssh-keygen
if you haven't already.
N.B. It is strongly advised to use a dedicated microk8s-homelab
SSH key pair for remoting into your instance and reverse tunneling instead of your default SSH key pair (if exists).
export CLOUD_PROVIDER="aws"
export TF_VAR_email="webmaster@example.com" # replace me!
tofu -chdir="opentofu/${CLOUD_PROVIDER}/" init
tofu -chdir="opentofu/${CLOUD_PROVIDER}/" plan
tofu -chdir="opentofu/${CLOUD_PROVIDER}/" apply
The following OpenTofu variables are supported for AWS.
Variable | Required | Type | Default | Description |
---|---|---|---|---|
email |
Y | string |
"webmaster@example.com" |
Required. Email address to use for Let's Encrypt notifications |
profile |
- | string |
"default" |
AWS profile to assume for AWS CLI v2 and OpenTofu |
region |
- | string |
"ap-east-1" |
AWS region to deploy the resources into |
vpc_cidr |
- | string |
"10.0.0.0/16" |
VPC CIDR block. Should be a valid RFC 1918 private subnet |
subnet_cidr |
- | string |
"10.0.1.0/24" |
Subnet CIDR block. Should be a valid subnet of the VPC CIDR block |
ssh_pubkey_path |
- | string |
"~/.ssh/microk8s-homelab.pub" |
Path to SSH public key. Evaluated with pathexpand() before use |
instance_type |
- | string |
"t3.micro" |
Instance type of MicroK8s reverse tunnel proxy |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。