1
resposta

Não consigo acessar a aplicação

Não consigo acessar a aplicação, 192.168.49.2:30000 'This site can’t be reached192.168.49.2 refused to connect.'

minikube ip 192.168.49.2

apiVersion: v1
kind: Pod
metadata:
  name: portal-noticias
  labels:
    name: portal-noticias
spec:
  containers:
  - name: portal-noticias-container
    image: aluracursos/portal-noticias:1
    resources:
      limits:
        memory: "256Mi"
        cpu: "500m"
    ports:
      - containerPort: 80
apiVersion: v1
kind: Service
metadata:
  name: svc-portal-noticias
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30000
  selector:
      app: portal-noticias
kubectl describe svc svc-portal-noticias
Name:                     svc-portal-noticias
Namespace:                default
Labels:                   <none>
Annotations:              <none>
Selector:                 app=portal-noticias
Type:                     NodePort
IP Families:              <none>
IP:                       10.99.21.173
IPs:                      10.99.21.173
Port:                     <unset>  80/TCP
TargetPort:               80/TCP
NodePort:                 <unset>  30000/TCP
Endpoints:                <none>
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
kubectl describe pod portal-noticias
Name:         portal-noticias
Namespace:    default
Priority:     0
Node:         minikube/192.168.49.2
Start Time:   Mon, 10 May 2021 21:25:39 -0700
Labels:       name=portal-noticias
Annotations:  <none>
Status:       Running
IP:           172.17.0.3
IPs:
  IP:  172.17.0.3
Containers:
  portal-noticias-container:
    Container ID:   docker://1a11b72ca46052883d1f9a7227446df774a0c3d99c8b0334ef32448689a09209
    Image:          aluracursos/portal-noticias:1
    Image ID:       docker-pullable://aluracursos/portal-noticias@sha256:c1f4e01ee56e948ea9b420ded272d3440b9d45afb5d7ba1c389e79487edfeec0
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 10 May 2021 21:25:40 -0700
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     500m
      memory:  256Mi
    Requests:
      cpu:        500m
      memory:     256Mi
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-7j4fg (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  default-token-7j4fg:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-7j4fg
    Optional:    false
QoS Class:       Guaranteed
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  43m   default-scheduler  Successfully assigned default/portal-noticias to minikube
  Normal  Pulled     43m   kubelet            Container image "aluracursos/portal-noticias:1" already present on machine
  Normal  Created    43m   kubelet            Created container portal-noticias-container
  Normal  Started    43m   kubelet            Started container portal-noticias-container
1 resposta

No metadata você colocou

metadata:
  name: portal-noticias
  labels:
    name: portal-noticias

porém quando foi referenciar no service vc colocou o label como "app"


  selector:
      app: portal-noticias

Pode ser por isso o erro