garutilorenzo / k3s-oci-cluster

Deploy a Kubernetes cluster for free, using k3s and Oracle always free resources
https://garutilorenzo.github.io/deploy-kubernetes-for-free-oracle-cloud
GNU General Public License v3.0
225 stars 79 forks source link

Access service from outside using Nginx #12

Closed andrebrito16 closed 2 years ago

andrebrito16 commented 2 years ago

Hello, I'm trying to access a service from URL, the ingress already exists but points to internal LB IP

image

Can you please help me and tell how can I access my service from outside?

Ps: I have saw the nginx config for WP but I tried to use to my service but without success.

garutilorenzo commented 2 years ago

Hi @andrebrito16,

i can't understand your request. Wath is the "URL" you are trying to access? Have you configured the ingress rules? Can you paste your full deployment here? Your application will be availalble at the defautl virtual host or you have to configure a domain? (Eg. example.com)

All your http(s) services will be available at address, and to do this you have to configure:

To better understand how network in kubernetes work, read this article.

andrebrito16 commented 2 years ago

Hi @garutilorenzo, sorry for this. I'm just starting with k8s concepts and devops.

Here is my ingress. The LB IP that are showing on Lens is private IP of one of k3s server instance.

image

I've tested the same deploy on single-node k3s cluster, and it worked but at Load Balancers field on Lens I see the public IP of my VPS. Using terraform that you provided to run k3s at Oracle, I see only private IP address at Load Balancer on Lens. Idk how to point from outside to private IP LB. Thanks for attention :)

garutilorenzo commented 2 years ago

Lens, like kubectl get svc will display only the private ip, since K3s is not integrated with Oracle Cloud. All you have to do is to open your browser and point to the ip address that terraform shows in the Outputs:

...
... 
Apply complete! Resources: 27 added, 0 changed, 0 destroyed.

Outputs:

k3s_servers_ips = [
  "X.X.X.X",
  "X.X.X.X",
]
k3s_workers_ips = [
  "X.X.X.X",
  "X.X.X.X",
]
public_lb_ip = tolist([
  "X.X.X.X",
])

kubectl or Lens don't know the public ip address ip.