Giter Club home page Giter Club logo

awsproject's Introduction

awsproject

awsproject's People

Contributors

pankaj-akhade avatar pankajakhade avatar

Watchers

James Cloos avatar

awsproject's Issues

Unable to curl a service/Unable to connect to a service from browser in Kubernetes

Hello,

I am new to Kubernetes.
I have created a cluster with one control plane and one worker node(AWS Ubuntu ec2 machines).
For this I have executed below commands on Ubuntu Master node:

1  apt-get update
2  apt-get install apt-transport-https
3  curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
4  cat <<EOF >/etc/apt/sources.list.d/kubernetes.list

deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

5  apt-get update
6  apt-get install -y docker.io
7  apt-get install -y kubelet kubeadm kubectl kubernetes-cni
8  kubeadm init
9  kubeadm init --ignore-preflight-errors=NumCPU --pod-network-cidr=10.240.0.0/16

10 mkdir -p $HOME/.kube
11 kubectl get nodes
12 kubtctl describe node
13 kubtctl describe nodes
14 kubectl describe nodes
15 sysctl net.bridge.bridge-nf-call-iptables=1
16 swapoff -a
17 kubectl describe nodes
18 kubectl get nodes
19 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
20 kubectl get nodes

And below commands on Ubuntu worker node:

1  apt-get update
2  apt-get install apt-transport-https
3  curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
4  cat <<EOF >/etc/apt/sources.list.d/kubernetes.list

deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

5  apt-get update
6  apt-get install -y docker.io
7  apt-get install -y kubelet kubeadm kubectl kubernetes-cni
8  swapoff -a
9  kubeadm join 172.31.19.73:6443 --token ziy4ub.lbwj7bj0jyg0w39b     --discovery-token-ca-cert-hash sha256:437144bad50f7c4d5e316e6136b1750db4c93c0ac2879c2a1ba5ab7a57310ae0

Both these VMs can connect to each other via ssh.

Now I created a typical deployment with below yaml file:

apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80

and created a service.
nginx-deployment NodePort 10.102.47.210 80:30357/TCP 30m

But now I am not able to curl/connect to this service:

root@ip-172-31-19-73:~/kube# curl -v 10.102.47.210

  • Rebuilt URL to: 10.102.47.210/
  • Trying 10.102.47.210...
  • TCP_NODELAY set
  • connect to 10.102.47.210 port 80 failed: Connection refused
  • Failed to connect to 10.102.47.210 port 80: Connection refused
  • Closing connection 0
    curl: (7) Failed to connect to 10.102.47.210 port 80: Connection refused

With port 30357, curl is stuck:(
root@ip-172-31-19-73:~/kube# curl -v 10.102.47.210:30357

  • Rebuilt URL to: 10.102.47.210:30357/
  • Trying 10.102.47.210...
  • TCP_NODELAY set

Also I am not able to curl pods as well:

nginx-deployment-54f57cf6bf-mj6gb 1/1 Running 0 38m 10.240.1.3 ip-172-31-29-100
nginx-deployment-54f57cf6bf-xnj5t 1/1 Running 0 38m 10.240.1.2 ip-172-31-29-100

It stuck too:(

root@ip-172-31-19-73:~/kube# curl -v 10.240.1.3

  • Rebuilt URL to: 10.240.1.3/
  • Trying 10.240.1.3...
  • TCP_NODELAY set

Could somebody please help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.