Angular application not accessible on browser deployed from minikube cluster

I deployed my own angular project on docker hub (one time the whole project and one time the dist folder after building the application), Both times logs showed successful deployment in the container.

Here is my config File for pod and service

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>apiVersion: apps/v1
kind: Deployment
metadata:
name: audit-logger-frontend
labels:
app: logger-frontend
spec:
replicas: 1
selector:
matchLabels:
app: logger-frontend
template:
metadata:
labels:
app: logger-frontend
spec:
containers:
- name: logger-frontend
image: huzaifi0604/logger-frontend:1.0
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: audit-logger-service
spec:
selector:
app: logger-frontend
type: NodePort
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 31000
</code>
<code>apiVersion: apps/v1 kind: Deployment metadata: name: audit-logger-frontend labels: app: logger-frontend spec: replicas: 1 selector: matchLabels: app: logger-frontend template: metadata: labels: app: logger-frontend spec: containers: - name: logger-frontend image: huzaifi0604/logger-frontend:1.0 ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: audit-logger-service spec: selector: app: logger-frontend type: NodePort ports: - protocol: TCP port: 80 targetPort: 80 nodePort: 31000 </code>
apiVersion: apps/v1
kind: Deployment
metadata:
  name: audit-logger-frontend
  labels:
    app: logger-frontend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: logger-frontend
  template:
    metadata:
      labels:
        app: logger-frontend
    spec:
      containers:
      - name: logger-frontend
        image: huzaifi0604/logger-frontend:1.0
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
    name: audit-logger-service
spec:
    selector:
        app: logger-frontend
    type: NodePort
    ports:
    - protocol: TCP  
      port: 80
      targetPort: 80
      nodePort: 31000

and this is the DockerFile for the project i deployed on Dockerhub

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Docker File for Deploying angular Application
# Use the official Node.js image
FROM node:18
# Updating the environment for the application
RUN apt-get update
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies with legacy peer deps
RUN npm install --legacy-peer-deps
# Copy the rest of the application source code
COPY . .
# Expose the port the app runs on
EXPOSE 4200
# Start the application
CMD ["npm", "start"]
</code>
<code>Docker File for Deploying angular Application # Use the official Node.js image FROM node:18 # Updating the environment for the application RUN apt-get update # Set the working directory WORKDIR /app # Copy package.json and package-lock.json COPY package*.json ./ # Install dependencies with legacy peer deps RUN npm install --legacy-peer-deps # Copy the rest of the application source code COPY . . # Expose the port the app runs on EXPOSE 4200 # Start the application CMD ["npm", "start"] </code>
Docker File for Deploying angular Application 
# Use the official Node.js image
FROM node:18

# Updating the environment for the application
RUN apt-get update

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies with legacy peer deps
RUN npm install --legacy-peer-deps

# Copy the rest of the application source code
COPY . .

# Expose the port the app runs on
EXPOSE 4200

# Start the application
CMD ["npm", "start"]

I tried using NodePort and LoadBalacer both with and without nodePort key. Exposed port 4200 in docker file and set as target and containerPort in config files, got correct endpoints on service descriptions even got the service URL for accessing in browser, but in my browser the application is just not accessible.

  • These were my Logs for the pod created:
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>D:K8isAudit_Logger_Deployment>kubectl logs audit-logger-frontend-8595d84b97-tlkl8
> [email protected] start
> ng serve
- Building...
Initial chunk files | Names | Raw size
main.js | main | 94.68 kB |
polyfills.js | polyfills | 86.03 kB |
styles.css | styles | 70.77 kB |
| Initial total | 251.48 kB
Application bundle generation complete. [2.580 seconds]
Watch mode enabled. Watching for file changes...
Re-optimizing dependencies because vite config has changed
➜ Local: http://localhost:4200/
</code>
<code>D:K8isAudit_Logger_Deployment>kubectl logs audit-logger-frontend-8595d84b97-tlkl8 > [email protected] start > ng serve - Building... Initial chunk files | Names | Raw size main.js | main | 94.68 kB | polyfills.js | polyfills | 86.03 kB | styles.css | styles | 70.77 kB | | Initial total | 251.48 kB Application bundle generation complete. [2.580 seconds] Watch mode enabled. Watching for file changes... Re-optimizing dependencies because vite config has changed ➜ Local: http://localhost:4200/ </code>
D:K8isAudit_Logger_Deployment>kubectl logs audit-logger-frontend-8595d84b97-tlkl8

> [email protected] start
> ng serve

- Building...

Initial chunk files | Names         |  Raw size
main.js             | main          |  94.68 kB |
polyfills.js        | polyfills     |  86.03 kB |
styles.css          | styles        |  70.77 kB |

                    | Initial total | 251.48 kB

Application bundle generation complete. [2.580 seconds]

Watch mode enabled. Watching for file changes...
Re-optimizing dependencies because vite config has changed
  ➜  Local:   http://localhost:4200/
  • and this was the service description
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>:K8isAudit_Logger_Deployment>kubectl describe service audit-logger-service
Name: audit-logger-service
Namespace: default
Labels: <none>
Annotations: <none>
Selector: app=logger-frontend
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.104.15.127
IPs: 10.104.15.127
Port: <unset> 8000/TCP
TargetPort: 4200/TCP
NodePort: <unset> 30000/TCP
Endpoints: 10.244.0.5:4200
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
</code>
<code>:K8isAudit_Logger_Deployment>kubectl describe service audit-logger-service Name: audit-logger-service Namespace: default Labels: <none> Annotations: <none> Selector: app=logger-frontend Type: LoadBalancer IP Family Policy: SingleStack IP Families: IPv4 IP: 10.104.15.127 IPs: 10.104.15.127 Port: <unset> 8000/TCP TargetPort: 4200/TCP NodePort: <unset> 30000/TCP Endpoints: 10.244.0.5:4200 Session Affinity: None External Traffic Policy: Cluster Events: <none> </code>
:K8isAudit_Logger_Deployment>kubectl describe service audit-logger-service
Name:                     audit-logger-service
Namespace:                default
Labels:                   <none>
Annotations:              <none>
Selector:                 app=logger-frontend
Type:                     LoadBalancer
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.104.15.127
IPs:                      10.104.15.127
Port:                     <unset>  8000/TCP
TargetPort:               4200/TCP
NodePort:                 <unset>  30000/TCP
Endpoints:                10.244.0.5:4200
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
  • Here are the Service URLs:
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>minikube service audit-logger-service
|-----------|----------------------|-------------|---------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|----------------------|-------------|---------------------------|
| default | audit-logger-service | 8000 | http://192.168.49.2:30000 |
|-----------|----------------------|-------------|---------------------------|
* Starting tunnel for service audit-logger-service.
|-----------|----------------------|-------------|-----------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|----------------------|-------------|-----------------------|
| default | audit-logger-service | | http://127.0.0.1:7261 |
|-----------|----------------------|-------------|-----------------------|
* Opening service default/audit-logger-service in default browser...
! Because you are using a Docker driver on windows, the terminal needs to be open to run it.
</code>
<code>minikube service audit-logger-service |-----------|----------------------|-------------|---------------------------| | NAMESPACE | NAME | TARGET PORT | URL | |-----------|----------------------|-------------|---------------------------| | default | audit-logger-service | 8000 | http://192.168.49.2:30000 | |-----------|----------------------|-------------|---------------------------| * Starting tunnel for service audit-logger-service. |-----------|----------------------|-------------|-----------------------| | NAMESPACE | NAME | TARGET PORT | URL | |-----------|----------------------|-------------|-----------------------| | default | audit-logger-service | | http://127.0.0.1:7261 | |-----------|----------------------|-------------|-----------------------| * Opening service default/audit-logger-service in default browser... ! Because you are using a Docker driver on windows, the terminal needs to be open to run it. </code>
minikube service audit-logger-service
|-----------|----------------------|-------------|---------------------------|
| NAMESPACE |         NAME         | TARGET PORT |            URL            |
|-----------|----------------------|-------------|---------------------------|
| default   | audit-logger-service |        8000 | http://192.168.49.2:30000 |
|-----------|----------------------|-------------|---------------------------|
* Starting tunnel for service audit-logger-service.
|-----------|----------------------|-------------|-----------------------|
| NAMESPACE |         NAME         | TARGET PORT |          URL          |
|-----------|----------------------|-------------|-----------------------|
| default   | audit-logger-service |             | http://127.0.0.1:7261 |
|-----------|----------------------|-------------|-----------------------|
* Opening service default/audit-logger-service in default browser...
! Because you are using a Docker driver on windows, the terminal needs to be open to run it.

Have any idea, what I might be doing incorrectly or might there be a network setting issue i m not aware of?

New contributor

Muhammad Huzaifa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật