I've a shipped app where a URL is hardcoded "upload.mydomain.io:123123/myRoute".
This DNS points to an VM where an NGINX distributes the traffic to services. Now I need to put a highly scalable service in front of the VM, WITHOUT having the possibility to change the hardcoded URL. I've tried so far:
As an DNS Distributer I use Cloudflare, where I also tried to do something with Page Rules.
Functions -> No Domain in EU
Cloud Run -> Only Port 80
App Engine -> Only Port 8080
Kubernetes Ingress -> I can put my Domain on, also with the port as Service port, but then in the URL the port is gone
This is my Kubernetes Manifest:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: myApp-api
name: myApp-api
spec:
replicas: 3
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
app: myApp-api
spec:
containers:
- name: myApp-api
env:
- name: NODE_ENV
value: production
image: eu.gcr.io/myApp-123/myApp-api:latest
imagePullPolicy: Always
ports:
- containerPort: 21337
restartPolicy: Always
status: {}
---
apiVersion: v1
kind: Service
metadata:
labels:
app: myApp-api-service
name: myApp-api-service
spec:
ports:
- name: myApp-api-port
port: 21337
targetPort: 21337
selector:
app: myApp-api
type: LoadBalancer
status:
loadBalancer: {}
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: myApp-api-ingress
spec:
tls:
- hosts:
- upload.myDomain.io
secretName: tls-secret
rules:
- host: upload.myDomain.io
http:
paths:
- path: /*
backend:
serviceName: myApp-api-service
servicePort: myApp-api-port
Is it possible somehow to create this route with some service?
You can achieve the same using Kubernetes service of type Loadbalancer.
For example
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: MyApp
ports:
- protocol: TCP
port: 123123
targetPort: 8000
Refer: https://cloud.google.com/kubernetes-engine/docs/concepts/service & https://kubernetes.io/docs/concepts/services-networking/#loadbalancer