I have a kubernetes cluster on GCP made of two nodes. I have pod -> mycha-deploy, with service -> mycha-svc, also I have pod nginx-controller with service nginx-svc. When I try to curl into the pods or services ips I keep getting: port 80 conection refused. When I browse into the master ip I don't get anything. Is there something I am missing in the configuration. Thank you.
# mycha-deploy
apiVersion: apps/v1
kind: Deployment
metadata:
name: mycha-deploy
labels:
app: mycha-app
spec:
replicas: 1
selector:
matchLabels:
app: mycha-app
template:
metadata:
labels:
app: mycha-app
spec:
containers:
- name: mycha-container
image: us.gcr.io/########/mycha-frontend_kubernetes_rrk8s
ports:
- containerPort: 80
#mycha-svc
apiVersion: v1
kind: Service
metadata:
name: mycha-svc
labels:
app: mycha-app
spec:
selector:
app: mycha-app
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
#nginx-controller
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-controller
spec:
replicas: 1
selector:
matchLabels:
name: nginx-ingress
template:
metadata:
labels:
name: nginx-ingress
spec:
containers:
- name: nginx-ingress-controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.27.0
args:
- /nginx-ingress-controller
- --configmap=$(POD_NAMESPACE)/nginx-configuration
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
#nignx-svc
apiVersion: v1
kind: Service
metadata:
name: nginx-ingress
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
- port: 443
targetPort: 443
protocol: TCP
name: https
selector:
name: nginx-ingress
##nginx-resource
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: mycha-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: mycha-svc
servicePort: 80
-----
kubectl describe svc nginx-ingress
Name: nginx-ingress
Namespace: default
Labels: app.kubernetes.io/name=ingress-nginx
app.kubernetes.io/part-of=ingress-nginx
Annotations: <none>
Selector: name=nginx-ingress
Type: NodePort
IP: 10.107.186.83
Port: http 80/TCP
TargetPort: 80/TCP
NodePort: http 32606/TCP
Endpoints: 10.244.1.3:80
Port: https 443/TCP
TargetPort: 443/TCP
NodePort: https 31481/TCP
Endpoints: 10.244.1.3:443
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
-------
kubectl get pods,svc
NAME READY STATUS RESTARTS AGE
pod/mycha-deploy-5f9b6f5c46-jjdhq 1/1 Running 0 76m
pod/nginx-controller-5c45cf6d5c-dpp44 1/1 Running 0 60m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 100m
service/mycha-svc ClusterIP 10.103.188.25 <none> 80/TCP 68m
service/nginx-ingress NodePort 10.107.186.83 <none> 80:32606/TCP,443:31481/TCP 51m
------
sudo lsof -i -P -n | grep LISTEN
systemd-r 890 systemd-resolve 13u IPv4 16536 0t0 TCP 127.0.0.53:53 (LISTEN)
splunkd 1111 root 4u IPv4 25377 0t0 TCP *:8089 (LISTEN)
sshd 1842 root 3u IPv4 23916 0t0 TCP *:22 (LISTEN)
sshd 1842 root 4u IPv6 23931 0t0 TCP *:22 (LISTEN)
kube-cont 22737 root 5u IPv6 116157110 0t0 TCP *:10252 (LISTEN)
kube-cont 22737 root 6u IPv4 116157116 0t0 TCP 127.0.0.1:10257 (LISTEN)
kube-prox 23291 root 8u IPv6 116256894 0t0 TCP *:31481 (LISTEN)
kube-prox 23291 root 11u IPv6 116256895 0t0 TCP *:32606 (LISTEN)
kube-prox 23291 root 16u IPv6 116164057 0t0 TCP *:10256 (LISTEN)
kube-prox 23291 root 17u IPv4 116164061 0t0 TCP 127.0.0.1:10249 (LISTEN)
etcd 23380 root 3u IPv4 116158620 0t0 TCP 10.242.6.2:2380 (LISTEN)
etcd 23380 root 5u IPv4 116158624 0t0 TCP 10.242.6.2:2379 (LISTEN)
etcd 23380 root 6u IPv4 116158625 0t0 TCP 127.0.0.1:2379 (LISTEN)
etcd 23380 root 11u IPv4 116157996 0t0 TCP 127.0.0.1:2381 (LISTEN)
kube-sche 23803 root 5u IPv6 116159474 0t0 TCP *:10251 (LISTEN)
kube-sche 23803 root 6u IPv4 116159480 0t0 TCP 127.0.0.1:10259 (LISTEN)
kube-apis 24180 root 5u IPv6 116163385 0t0 TCP *:6443 (LISTEN)
node 27844 robertorios 20u IPv4 116024875 0t0 TCP 127.0.0.1:38509 (LISTEN)
kubelet 30601 root 10u IPv4 116038855 0t0 TCP 127.0.0.1:33119 (LISTEN)
kubelet 30601 root 17u IPv6 116038993 0t0 TCP *:10250 (LISTEN)
kubelet 30601 root 31u IPv4 116038997 0t0 TCP 127.0.0.1:10248 (LISTEN)
Thank you.