ingress external ip
in kubernetes our ingress is looking at service and it looks at endpoint
technically we can craete endpoint manualy by defining target ip address
and if there is connectivity between we can accomplish something like that
by applying
---
# Note: we are creating endpoint manualy, usualy it is done by defauly by kubernetes, whenever we create service
apiVersion: v1
kind: Endpoints
metadata:
name: my-awesome-app
subsets:
- addresses:
- ip: 10.53.10.3 # ip address accessible from kuberenetes
ports:
- port: 80
---
# Note: we are not defining any selectors for pods
apiVersion: v1
kind: Service
metadata:
name: my-awesome-app
spec:
ports:
- protocol: TCP
port: 80
# Note: alternative approach with dns cname instead of ip address
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: my-awesome-app
# spec:
# type: ExternalName
# externalName: my-awesome-app.rabota.ua
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-awesome-app
spec:
ingressClassName: external
rules:
- host: my-awesome-app.mac-blog.org.ua
http:
paths:
- backend:
service:
name: my-awesome-app
port:
number: 80
path: /
pathType: ImplementationSpecific
note that we can have two options - by defining ip addresses or dns names
and to check if thats working we may do something like
kubectl exec some-pod-in-kube-xxxx -- curl -s --resolve my-awesome-app.mac-blog.org.ua:80:20.12.178.67 http://my-awesome-app.mac-blog.org.ua/login.aspx
curl -s --resolve my-awesome-app.mac-blog.org.ua:80:20.12.178.67 http://my-awesome-app.mac-blog.org.ua/login.aspx