Set Nginx ingress in Kubernetes cluster GKE to subdomain DNS records? - nginx

Hello I have a GKE cluster with a cert manager pod and ingress nginx server pod.
The ingress NGINX server has two external ips with port 80 and 443.
I can access port 80 but it is insecure. How can I assign my sub domain for example:
dev.example.com to this ingress ip address?
If I have Cloud DNS set up and also Hover set up is it conflicting of each other?
Thanks

Related

How to host WordPress website on NGINX container using AWS FARGATE

I need two containers in one task defination. One for wordpress and another for nginx, however the traffic should route from nginx to wordpress. This should be done using aws fargate.
How to connect two containers ? so that nginx should send traffic to wordpress container !
In AWS Fargate, all containers in the same task can access each other at 127.0.0.1 or localhost over their respective ports.
Let's say you have Nginx configured to listen on port 80 and WordPress configured to listen on port 9000. To setup Nginx and Wordpress as you describe, you would have your Application Load Balancer forward traffic to the Nginx container on port 80, and you would configure Nginx to forward traffic to WordPress at 127.0.0.1:9000.

Internal nginx besides a k3s setup on one vps

currently I run a nginx on a vps and I want to install k3s. The vps has two public reachable IP addresses and I want that the nginx on the vps itself only react to one specific of these two addresses.
Where can I realize that I can run the internal nginx besides the k3s?
You can do that with NodePort. You can create Nginx Service in K3S of the NodePort type.
Node port will expose your service to host on specific port.
References:
Kubernetes docs: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
Rancher docs: https://rancher.com/docs/rancher/v2.x/en/v1.6-migration/expose-services/

How to expose kubernetes web server to port 80

I have a tornado webserver + nginx + DNS. I have moved the webserver to a kubernetes pod and same with nginx.
But i realized that cant expose to port 80 then i kept nginx outside from kubernetes and changed webserver ip by the ip of the pod and works without problems.
The problem is that each time the ssh server restarts the pod's ip changes and i need to manually change the ip on nginx conf.
How can i or keep pod's ip between reloads or expose nginx on a pod to outside?
Use a load balancer between DNS and nginx ingress controller. The load balancer can accept traffic on port 80 and forward to nodeport on which nginx ingress controller is exposed.
Alternatively use the nginx ingress controller and run it with hostNetwork: true in deployment pod spec to run nginx ingress controller directly on port 80 in host's network namespace. Then configure DNS to forward traffic to nodeip:80
Create a cluster IP type kubernetes service and an ingress resource to access pod exposed via nginx. Nginx ingress controller will forward traffic to POD IPs directly. There is no change needed anywhere in this setup in case pod IP changes because nginx ingress controller watches for any change in POD IP and updates the nginx.conf accordingly.

Config nginx to listen to all ports

I have a flask app deployed in an EC2, configured with nginx/gunicorn3. Security group in the EC2 is both(inbound and outbound) set in all traffic.
I am having an issue with nginx configuration.
I have set it to listen to port 8080 and it only works on this port (neither port 80 will do).
What I want to do is to hit the domain without the port 8080 and return the desired results. Any ideas?
You can do the following to solve the issue:
1- Change the Nginx configuration to listen on port 80 and expose port 80
2- keep port 8080, but use a load balancer in front of the EC2 node and link the domain name to the load balancer instead of the EC2 node.

how to config basehref for kubernetes dashboard

The k8s cluster is installed on a host which is only allowed requests through port 443 from external network. That means all the pods managed by k8s only can be reached through port 443. I installed a Nginx on the host to server reverse proxy to k8s cluster. I installed dashboard and other apps in k8s. The k8s dashboard is exposed with a nodePort 31117. How to config a basehref in k8s dashboard? For example https://ip/dashboard to open the k8s dashboard.
You need to set up an upstream in nginx. Since you have exposed it as NodePort -
location /dashboard/ {
proxy_pass https://<any-node-ip>:<dashboard-node-port>/;
}
You can also look at Ingress resource using which you can do the same without hosting your own nginx server.

Resources