Home > Back-end >  Kubernetes - How to access deployments in minikube?
Kubernetes - How to access deployments in minikube?

Time:01-28

I have used the following configurations to deploy an app on minikube.

Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: angular-app
spec:
  replicas: 2
  selector:
    matchLabels:
      run: angular-app
  template:
    metadata:
      labels:
        run: angular-app
    spec:
      containers:
      - name: angular-app
        image: nheidloff/angular-app
        ports:
        - containerPort: 80
        - containerPort: 443
    

Service:

apiVersion: v1
kind: Service
metadata:
  name: angular-app
  labels:
    run: angular-app
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http

Service description:

Name:                     angular-app    
Namespace:                default        
Labels:                   run=angular-app
Annotations:              <none>
Selector:                 <none>
Type:                     NodePort       
IP Family Policy:         SingleStack    
IP Families:              IPv4
IP:                       10.102.174.98  
IPs:                      10.102.174.98
Port:                     http  80/TCP
TargetPort:               80/TCP
NodePort:                 http  31503/TCP
Endpoints:                172.17.0.3:80,172.17.0.4:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

When i try to access the endpoints, the links are not responding. However after using minikube service angular-app. Following showed up:

|-----------|-------------|-------------|---------------------------|
| NAMESPACE |    NAME     | TARGET PORT |            URL            |
|-----------|-------------|-------------|---------------------------|
| default   | angular-app | http/80     | http://192.168.49.2:31503 |
|-----------|-------------|-------------|---------------------------|
           
  •  Tags:  
  • Related