I am doing my practice on Kubernetes through Minikube on my AWS EC2. As part of that, I have created deployment and exposed that through NodePort service, then checked with:
curl http://<node-ip>:<service-port>
in EC2 Machine that worked fine. But when I hit the same URL on browser gave me:
This site can't be reached
Can anyone help me what is the problem and how can I access this?
Thank you.
This is my Deployment YAML file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: myfirstdeployment
labels:
app: web
spec:
replicas: 1
selector:
matchLabels:
app: web
template:
metadata:
name: myfirstpod
labels:
app: web
spec:
containers:
- name: myfirstpod-1
image: nginx
command: ["sleep","3600"]
ports:
- containerPort: 80
This is my Service YAML file
apiVersion: v1
kind: Service
metadata:
name: myfirstservice
spec:
selector:
app: web
ports:
- targetPort: 80 #target container's port
port: 80 #service port
nodePort: 30030 #node port that we access to
type: NodePort