<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: pinakinc</title>
    <description>The latest articles on DEV Community by pinakinc (@pinakinc).</description>
    <link>https://dev.to/pinakinc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F768085%2F0ffdcd7d-da30-477b-91e5-ed0abd1e891d.jpeg</url>
      <title>DEV Community: pinakinc</title>
      <link>https://dev.to/pinakinc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pinakinc"/>
    <language>en</language>
    <item>
      <title>Unable to access deployed Angular application on Google cloud</title>
      <dc:creator>pinakinc</dc:creator>
      <pubDate>Sat, 04 Dec 2021 12:42:49 +0000</pubDate>
      <link>https://dev.to/pinakinc/unable-to-access-deployed-angular-application-on-google-cloud-384p</link>
      <guid>https://dev.to/pinakinc/unable-to-access-deployed-angular-application-on-google-cloud-384p</guid>
      <description>&lt;p&gt;I have developed my project on Google cloud using Nodejs,Angular, MongoDB and Express. I have successfully built the Authentication part for Express and Node.js. Now I am trying to integrate Angular. I have setup Ingress-NGINX using Google cloud and am utilizing Google cloud shell to create the code.&lt;/p&gt;

&lt;p&gt;I followed the steps below for setup&lt;/p&gt;

&lt;p&gt;Steps for setting up Ingress-NGINX on Google Cloud&lt;/p&gt;

&lt;p&gt;1) Create a project blog-dev&lt;br&gt;
2) Create cluster blog-dev with 3 N1-g1 small instances in us-central1-c zone&lt;br&gt;
3) Navigate to &lt;a href="https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke"&gt;https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke&lt;/a&gt;&lt;br&gt;
4) On the Google cloud account, open the cloud shell and navigate to BPB_MEAN_Framework directory in terminal&lt;br&gt;
5) Execute the command &lt;code&gt;gcloud init&lt;/code&gt;, reinitialize the cluster, select the account, project and the region&lt;br&gt;
6) Execute the command &lt;code&gt;gcloud container clusters get-credentials blog-dev&lt;/code&gt;&lt;br&gt;
7) Execute the command &lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.3/deploy/static/provider/cloud/deploy.yaml&lt;/code&gt; to configure ingress-nginx&lt;br&gt;
8) Go to Network Services -&amp;gt; Load Balancing and check that the Load Balancer has got created. Note the ip of the Load Balancer&lt;br&gt;
Open the hosts.ini file and update as shown below 130.211.113.34 blog.dev &lt;br&gt;
8.1) &lt;code&gt;kubectl create secret generic jwt-secret --from-literal=JWT_KEY=asdf&lt;/code&gt;&lt;br&gt;
9) Run scaffold dev&lt;br&gt;
10) Go to &lt;a href="http://blog.dev"&gt;http://blog.dev&lt;/a&gt; in a browser and get the 'Privacy Error' page. Click 'Advanced' here&lt;br&gt;
Type thisisunsafe on keyboard&lt;br&gt;
The various files are listed below&lt;/p&gt;

&lt;p&gt;Listed below is the Kubernetes deployment yaml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`apiVersion: apps/v1
kind: Deployment
metadata: 
  name: client-depl
spec: 
  replicas: 1
  selector: 
    matchLabels:
      app: client
  template: 
    metadata:
      labels:
        app: client 
    spec:
      containers:
        - name: client
          image: us.gcr.io/blog-dev-326403/client:project-latest
---
apiVersion: v1
kind: Service
metadata:
  name: client-srv
spec:
  selector:
    app: client
  ports: 
    - name: client
      protocol: TCP
      port: 4200
      targetPort: 4200`    

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Listed below is the Ingress service&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`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: blog.dev
      http:
        paths:
          - path: /api/users/?(.*)
            backend:
              serviceName: auth-srv
              servicePort: 3100
          - path: /?(.*)
            backend:
              serviceName: client-srv
              servicePort: 4200`

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Listed below is the Skaffold yaml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl: 
    manifests:
      - ./infra/k8s/*
build:
  #local:
   # push: false
  googleCloudBuild:
    projectId: blog-dev-326403
  artifacts:
    - image: us.gcr.io/blog-dev-326403/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/.ts'
            dest: .
    - image: us.gcr.io/blog-dev-326403/client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/.ts'
            dest: .`

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The angular folder structure is shown below Angular project folder structure&lt;/p&gt;

&lt;p&gt;I added the Google cloud Load Balancer ip followed by blog.dev in hosts.ini file.&lt;/p&gt;

&lt;p&gt;When I run skaffold dev, there are no errors. When I try to access blog.dev, I get a 502 bad gateway.&lt;/p&gt;

&lt;p&gt;When I navigate to client directory and type npm start and access preview in Google cloud shell, I get my website as shown Application in preview mode in Google cloud Please help...This is a showstopper for me&lt;/p&gt;

</description>
      <category>angular</category>
      <category>ingressnginx</category>
      <category>kubernetes</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
