title: K8S: How to reach pod with SSH service (Gitea) over the same host ingress-nginx exposes as HTTP?
body: <p>Currently practicing with Kubernetes (managed, on DO), I ran into a issue I couldn't resolve for two days. I have nginx-ingress setup along with cert-manager, and a domain where git.domain.com points to the IP of the load balancer. I can reach my Gitea deployment via the web, everything seems to work.</p>
  
  <p>What I want to achieve now is, that I can also use SSH like so</p>
  
  <pre><code>git clone git@git.domain.com:org/repo.git
  </code></pre>
  
  <p>So I somehow need to expose the container port 22 via the service, then via the ingress. I tried a couple of things, but none of them seemed to work, probably because I'm a starter at K8S. Here is the working setup I use.</p>
  
  <p>Service definition:</p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: gitea-service
  spec:
    selector:
      app: gitea
    ports:
    - name: gitea-http
      port: 3000
      targetPort: gitea-http
    - name: gitea-ssh
      port: 22
      targetPort: gitea-ssh
  </code></pre>
  
  <p>Ingress definiton</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: echo-ingress
    annotations:  
      kubernetes.io/ingress.class: nginx
      certmanager.k8s.io/cluster-issuer: letsencrypt-prod
  spec:
    tls:
    - hosts:
      - git.domain.com
      secretName: letsencrypt-prod
    rules:
    - host: git.domain.com
      http:
        paths:
        - backend:
            serviceName: gitea-service
            servicePort: gitea-http
  </code></pre>
  
  <p>And part of my deployment, just to make sure:</p>
  
  <pre><code>...
  ports:
          - containerPort: 3000
            name: gitea-http
          - containerPort: 22
            name: gitea-ssh
  ...
  </code></pre>
  
  <p>Sorry if it's a dumb question, I think there is some basics that I confuse here. Thanks!</p>