<p>I am new to Kubernetes in GCE-GKE, I was trying to build and deploy the nodeJS app in GCE-GKE cluster using the skaffold.Yaml. I can see image got build and also deployed withoutr any issue but when I tried to access GET the index.ts file on browser, I can't. I really don't understand what might have gone wrong or I may have missed something at LB or ingress-nginx.</p>

<p>Below id the skaffold.yaml </p>

<pre><code>apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  # local:
  #   push: false
  googleCloudBuild:
    projectId: xxxxxxxxxxxx
  artifacts:
    - image: us.gcr.io/xxxxxxxxxxx/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
</code></pre>

<p>Below is ingress-srv.yaml</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
  rules:
    - host: ticketing.dev
      http:
        paths:
          - path: /api/users/?(.*)
            backend:
              serviceName: auth-srv
              servicePort: 3000
</code></pre>

<p>Below is auth-depl.yaml</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth
  template:
    metadata:
      labels:
        app: auth
    spec:
      containers:
        - name: auth
          image: us.gcr.io/xxxxxxxxxxxxx/auth
---
apiVersion: v1
kind: Service
metadata:
  name: auth-srv
spec:
  selector:
    app: auth
  ports:
    - name: auth
      protocol: TCP
      port: 3000
      targetPort: 3000
</code></pre>

<p>Below is package.json</p>

<pre><code>{
  "name": "auth",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "ts-node-dev --poll src/index.ts"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@types/express": "^4.17.6",
    "express": "^4.17.1",
    "nodemon": "^2.0.4",
    "typescript": "^3.9.5"
  },
  "devDependencies": {
    "ts-node-dev": "^1.0.0-pre.44"
  }
}
</code></pre>

<p>Below is index.ts</p>

<pre><code>import express from 'express';
import { json } from 'body-parser';

const app = express();
app.use(json());
// /api/users/currentuser
app.get('/users', (req, res) =&gt; {
  res.send('Hello');
});

app.listen(3000, () =&gt; {
  console.log('Great');
  console.log('listening on port 3000!!!!!');
});
</code></pre>

<p>Below is docker file</p>

<pre><code>FROM node:alpine

WORKDIR /app
COPY package.json .
RUN npm install
COPY . .

CMD ["npm", "start"]

</code></pre>

Aadil Nabi
<p>Which tools you use to manage domain configuraion?</p>

<p>Step 1: As far as i know, after you init nginx on your k8s cluster, you need add a DNS record to map a domain (or subdomain) in your domain (ticketing.dev) to external IP or external DNS of your k8s cluster which nginx have regenerated for you (i use an A record normally).</p>

<p>Step 2: After that, when you have deployed your application, you need to set the domain of your app (domain name you specify in your ingress yaml file) is a CNAME record of the above (A) record.</p>

<p>You can verify your domain verify cation by use <code>nslookup</code> command.
If you do not use proxy for your domain, both of above domain (A and CNAME record) will be resolve to the same your externall IP of your k8s cluster.</p>

<p>The purpose of 2 above steps is that you let the DNS server know where (which IP) to resolve when the DNS server get a req ask about any your subdomain (domain). That why you can use <code>nslookup</code> command to verify your configuration.</p>

<p>Below is the tools i have used to manage DNS of our domain: 
<a href="https://www.namecheap.com/support/knowledgebase/article.aspx/9607/2210/how-to-set-up-dns-records-for-your-domain-in-cloudflare-account" rel="nofollow noreferrer">https://www.namecheap.com/support/knowledgebase/article.aspx/9607/2210/how-to-set-up-dns-records-for-your-domain-in-cloudflare-account</a>
<a href="https://www.namecheap.com/support/knowledgebase/article.aspx/9607/2210/how-to-set-up-dns-records-for-your-domain-in-cloudflare-account" rel="nofollow noreferrer">example</a></p>
