I have a Kubernetes cluster where I'm trying to deploy a Gitea application that listens on port :22 in container for tls SSH, but I need to expose port :222 externally for users. What is the way to achieve this port forwarding?
The goal is to allow users to use the command 'git clone ssh://git@domain-name:222/'."
I try this in my deployment:
---
apiVersion: v1
kind: Service
metadata:
name: gitea-ssh
namespace: develop
labels:
app: gitea-ssh
spec:
selector:
app: gitea
ports:
- name: gitea-ssh
port: 222
#targetPort: 22
type: ClusterIP
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
name: ingressroutetcp.crd
namespace: develop
spec:
entryPoints:
- ssh
routes:
- match: HostSNI(`*`)
services:
- name: gitea-ssh
port: 22