patternkubernetesMinor
Expose kubernetes deployment on master's IP
Viewed 0 times
kubernetesexposemasterdeployment
Problem
I have simple deployment which has 3 replicas. I want this deployment to be load balanced between this 3 replicas, but available under IP of my
This cluster was created by using
-
I tried to create ingress` to make it work, but unsuccessfully.
What is the proper approach here?
If the above is possible then second question: is it possible to expose it on 2 masters if I will want to create 2nd one?
master and on some specified port.This cluster was created by using
kubeadm, I have one master and 20 worker nodes.- I tried to expose the service as
LoadBalancer, but this only works when you have cloud load balancer configured. I don't have such thing andEXTERNAL-IPis always `.
- I tried to expose the service as NodePort
, but this only works on nodes wherepodswere created. So for example after rollout, whenpodswill be created on different nodes, it will stop working. Also I guess this is not load balanced properly.
-
I tried to create ingress` to make it work, but unsuccessfully.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: registry-ingress
namespace: registry
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /registry
backend:
serviceName: registry-service
servicePort: 5000What is the proper approach here?
If the above is possible then second question: is it possible to expose it on 2 masters if I will want to create 2nd one?
Solution
I was wrong about the
After unblocking this ports everything was working fine with
NodePort approach. It was firewall blocking the connection to my master on ports 30000-32767.After unblocking this ports everything was working fine with
NodePort service.Context
StackExchange DevOps Q#3638, answer score: 1
Revisions (0)
No revisions yet.