I have deployed kubernetes cluster (with only one Node as master) onto a ec2 instance. After this, I created a nginx deployment and exposed the service using "Type" as NodePort. The nginx service is available on ec2 privateIP:31336 and also able to access via ec2 publicIP:31336 from my computer.
At this stage , I am having follwing questions: 1) what to do in next step in order to access the http service from outside of the cluster i.e., a successful "curl ec2publicIP:80" operation? Any guide would be extremly helpful.
Note: - My ec2 security rule is configured to allow http traffic. - After logging into nginx pod, I'm able to ping google.com but the apt-get update gets timeout. - I have updated the IP forwading in my EC2 instance.
2) What would be the best and simple option among NodePort, ingress controller or ELB as type for kube services.
3) Also, where does the IPtables fits into it. Can it be avoided manually chnaging it's rule by using any of the above or other tools/pkgs which will take care of the networking ?
Your response would be highly appreciated.
apiVersion: apps/v1 kind: Deployment metadata: name: demo-nginx spec: selector: matchLabels: run: demo-nginx replicas: 1 template: metadata: labels: run: demo-nginx spec: containers: - name: demo-nginx image: k8s.gcr.io/nginx:1.7.9 ports: - containerPort: 80
apiVersion: v1 kind: Service metadata: name: demo-nginx labels: run: demo-nginx spec: ports: - port: 80 protocol: TCP selector: run: demo-nginx type: NodePort