Closed andrebrito16 closed 2 years ago
Hi @andrebrito16, i've created a new branch kubeapi_public_access with this new feature. The code is not tested, but i think it will work. If you want to test the code, you are welcome :)
In your main.tf file you have to add a new variable: expose_kubeapi, and set the variable to true.
module "k3s_cluster" {
region = var.region
availability_domain = "<change_me>"
compartment_ocid = var.compartment_ocid
my_public_ip_cidr = "<change_me>"
cluster_name = "<change_me>"
environment = "staging"
k3s_token = "<change_me>"
certmanager_email_address = "<change_me>"
expose_kubeapi = true
source = "../"
}
Thanks for help @garutilorenzo! I applied this and terraform apply runs without any errors. But I still getting timeout when trying to connect to kubernetes api via Lens, for example. :(
Fixed, a NSG rule was missing.
lorenzo@mint-virtual:~$ export KUBECONFIG=oci-kubeconfig.yaml
lorenzo@mint-virtual:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
inst-cnhyq-k3s-servers Ready control-plane,etcd,master 6m8s v1.24.3+k3s1
inst-gxrup-k3s-servers Ready control-plane,etcd,master 7m49s v1.24.3+k3s1
inst-pmnj5-k3s-workers Ready <none> 6m40s v1.24.3+k3s1
inst-xjupx-k3s-workers Ready <none> 6m45s v1.24.3+k3s1
with this fix you have to destroy and recreate all the infrastructure.
Thank you so much @garutilorenzo. Now it worked like a charm! And congrats for the excellent job!
Hello, I'm trying to access K8s API from outside, to use lens for example. I've tried to follow steps that this suggested but not working. Can you please help me?