Can I Connect OVH Loadbalancer to my Kubernetes Cluster from OVH Cloud provider - kubernetes

I have Kubernetes Cluster v1.10 Over Centos 7 Over OVH Cloud Provider's Servers .
As I knew OVH does not Provide Loadbalancer Component Directly to Kubernetes
And I want to buy Loadbalancer Component From OVH From this Link and connect to kubernetes Cluster .
Can I connect Loadbalancer to Kubernetes?
And is there any tutorial?
Thank You :D

Yes.
You can follow this guide from OVH in terms setting up your load balancer.
And in terms of Kubernetes you'd either want to create a Kubernetes Ingress exposed on a NodePort, this is a good tutorial for that, or you can also expose your services directly on a NodePort and point your load balancer's backend to all the nodes in your cluster on that specific NodePort.
I would also familiarize with the Services abstraction in Kubernetes.

Yes, you can.
How, on the other side, is not an obvious one. My suggestion would be to make it part of your kubernetes infra provisioning with terraform. Using https://www.terraform.io/docs/providers/ovh/r/iploadbalancing_tcp_farm_server.html you can manage endpoints for your loadbalancer based on instances / hosts provisioned either manually or with openstack provider. That's how I do it on our OVH Kube cluster.

Related

Configure keepalived for services (NodePort) on kubernates

I have a k8s cluster which contains 2 nodes. And in the cluster I deployed 2 pods for the same application. Due to some reason I have to deploy a service (NodePort IP) for each pod, so totally I have 2 services the application, for example the service NodePort IP is 192.142.1.11 and 192.142.1.12. And use these 2 ips I can access the application from any node.
Now I am going to use keepalived to set up HA for the application. So:
What's the best practice to install the keepalived service? On each k8s node or deploy it as pod?
How to configure the interface in the keepalived.conf file? You know the NodePort ips are configured on kube-ipvs0 interface created by k8s and its status is down. Seems it cannot be used as the interface in keepalived.conf. Should I use the Node external interface if I start keepalived service on each node?
Thanks for your help.
If your final goal is masters HA / users service load balancing in on-prem environment, then you can take a look on this two project:
Kubevip: can do both (HA masters + LoadBalancer type for user workload).
Metallb:
user workload LoadBalancer

expose pgbouncer service to external clients

I am trying to implement pgbouncer on k8s, using a helm chart created deployment,service…now how do I expose the service to outside world? Not much familiar with k8s networking, tried to create an ingress resource and it created an elb in aws…how do I map this elb to the service and expose it?
the service is created with type ClusterIP…the service is a tcp service i.e. not http/https application (edited)
The helm chart used is - https://github.com/futuretechindustriesllc/charts/tree/master/charts/pgbouncer
Ingresses are only used for HTTP and friends. In this case what you want is probably a LoadBalancer type service. That will make a balancer fabric and then expose it via an ELB.

Can we reach a server running inside kubernetes Cluster from Outside?

I have a requirement that the server that is running inside one of my container in a k8s cluster should be able to reach a server that is running in some other machine (currently its in AWS).Now the problem is that both the server (in AWS & Kubernetes Cluster) should be able to reach each other.
My server in AWS is not able to ping my Server running in Kubernetes Cluster.
Is that possible? Can we do it ?
Yes you can use ingress-nginx to create publicly reachable services ingress-nginx
If you want to do it manually you can setup load balancers that map to specific ip ranges for your nodes. This is for ssh traffic.
yes you can use ingress kubernetes object it will create publicly reachable services.
Mainly if you are using aws or digital-ocean and you will use ingress it will make load balancer (ELB or ALB) and make public service and you can access server running inside kubernetes
By manually also you can do it just simply use kubernetes service and expose it using load balancer and NODE port
https://kubernetes.io/docs/concepts/services-networking/service/

Which host-url should be provided to Ingress for Traefik in Kubernetes AWS?

I am trying to set up Treafik in my Kubernetes cluster running on AWS. I am having problems understanding the host-url that is used in the ingress-service. The tutorial in their page was nice but the think is that running in minikube you have just one node so you are going to map that IP to the Host that you are going to use in Treafik.
I don't know which IP should I map in case of Kubernetes in AWS. The master url? What happens when I have multiple masters?
The host-url is the external IP of the Traefik Load-Balancer in AWS. In minikube there is no external IP so I think they did it this way (to use the minikube IP) for testing.
I suffered a bit to understand the point that when using Traefik (or other Ingress controllers) we have just one Load-Balancer, the one of the Traefik in this case, and the other services will point to this one. Traefik then will redirect the traffic.

Kubernetes External Load Balancer Service on DigitalOcean

I'm building a container cluster using CoreOs and Kubernetes on DigitalOcean, and I've seen that in order to expose a Pod to the world you have to create a Service with Type: LoadBalancer. I think this is the optimal solution so that you don't need to add external load balancer outside kubernetes like nginx or haproxy. I was wondering if it is possible to create this using DO's Floating IP.
Things have changed, DigitalOcean created their own cloud provider implementation as answered here and they are maintaining a Kubernetes "Cloud Controller Manager" implementation:
Kubernetes Cloud Controller Manager for DigitalOcean
Currently digitalocean-cloud-controller-manager implements:
nodecontroller - updates nodes with cloud provider specific labels and
addresses, also deletes kubernetes nodes when deleted on the cloud
provider.
servicecontroller - responsible for creating LoadBalancers
when a service of Type: LoadBalancer is created in Kubernetes.
To try it out clone the project on your master node.
Next get the token key from https://cloud.digitalocean.com/settings/api/tokens and run:
export DIGITALOCEAN_ACCESS_TOKEN=abc123abc123abc123
scripts/generate-secret.sh
kubectl apply -f do-cloud-controller-manager/releases/v0.1.6.yml
There more examples here
What will happen once you do the above? DO's cloud manager will create a load balancer (that has a failover mechanism out of the box, more on it in the load balancer's documentation
Things will change again soon as DigitalOcean are jumping on the Kubernetes bandwagon, check here and you will have a choice to let them manage your Kuberentes cluster instead of you worrying about a lot of the infrastructure (this is my understanding of the service, let's see how it works when it becomes available...)
The LoadBalancer type of service is implemented by adding code to the kubernetes master specific to each cloud provider. There isn't a cloud provider for Digital Ocean (supported cloud providers), so the LoadBalancer type will not be able to take advantage of Digital Ocean's Floating IPs.
Instead, you should consider using a NodePort service or attaching an ExternalIP to your service and mapping the exposed IP to a DO floating IP.
It is actually possible to expose a service through a floating ip. The only catch is that the external IP that you need to use is a little unintuitive.
From what it seems DO has some sort of overlay network for their Floating IP service. To get the actual IP you need to expose you need to ssh into your gateway droplet and find its anchor IP by hitting up the metadata service:
curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address
and you will get something like
10.x.x.x
This is the address that you can use as an external ip in LoadBalancer type service in kubernetes.
Example:
kubectl expose rc my-nginx --port=80 --public-ip=10.x.x.x --type=LoadBalancer