Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use ip address in Kubernetes Ingress instead of domain name?

I am using Traefik as Kubernetes Ingress and I would like to know if I can use an IP address instead of a domain name. Example:

http://ipaddress/service1
http://ipdadress/service2

My ingress configuration:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: service1
  namespace: staging
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.frontend.rule.type: PathPrefixStrip
spec:
  rules:
  - host: mydomain.dev
    http:
      paths:
      - path: /service1
        backend:
          serviceName: service1
          servicePort: 3000
like image 878
cleitond Avatar asked Oct 19 '25 02:10

cleitond


1 Answers

Since it is a Layer 7 Load Balancer you can't use IP address directly. But if you use nip.io and for example 192-168-1-1.nip.io as your hostname it would work and you can do all the things you can regularly do with normal hostnames such as redirect app1.192-168-1-1.nip.io to app1 and 192-168-1-1.nip.io/app2 to app2 etc.

like image 56
Akin Ozer Avatar answered Oct 21 '25 20:10

Akin Ozer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!