I can not access to the web page even thought the kubernete has deployed the services on AWS EC2 successfully and i can check that it is running and
Web Browser Link : EC2 public IP (and i have tried private IP and external ip from kubectl get services):8080 (also have tried 31200)
Result:
Unable to connect
i also try to below command but the result is with failed connection` refused.
wget 127.0.0.1:8080 and wget 127.0.0.1:31200
Firewall rule for 8080 and 31200 are opened.
i am deploying an web application through kubernetes deployment and service on AWS EC2 as below command
ansible-playbook -i /opt/kubernetes/hosts /opt/kubernetes/website-deployment.yml;
ansible-playbook -i /opt/kubernetes/hosts /opt/kubernetes/website-service.yml;
The deployment.yml is
---
- name: Create pods using deployment
hosts: localhost
become: true
user: root
tasks:
- name: create a deployment
command: kubectl apply -f /opt/docker/website-deployment.yml
- name: update deployment with new pods whenever image updated in docker hub
command: kubectl rollout restart deployment.v1.apps/website-deployment
The service yml is
---
- name: create service for deployment
hosts: localhost
become: true
user: root
tasks:
- name: create a service
command: kubectl apply -f /opt/docker/website-service.yml
when i run
kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
web-service LoadBalancer 100.64.119.242 afefc1ecf599f4a16a12aa2fe5dbbb30-614667794.ap-south-1.elb.amazonaws.com 8080:***31200***/TCP 12h
kubernetes ClusterIP 100.64.0.1 <none> 443/TCP 36h
kubectl get pods
NAME READY STATUS RESTARTS AGE
web-service-deployment-7df8c9bc7c-g9hkp 1/1 Running 0 135m
web-service-deployment-7df8c9bc7c-pmtlv 1/1 Running 0 135m
sample-nginx 1/1 Running 0 38h