Open naeem4github opened 3 years ago
I know this works for centos 8 but, disable firewalld, flush ip tables, set /etc/docker/daemon.json to { "exec-opts": ["native.cgroupdriver=systemd"] }
you need to remove weave net prior to installing the weave CNI add-in
What you expected to happen?
What happened?
I setup a cluster for my personal study but I am unable to communicate with the POD or Service
How to reproduce it?
root@ip-172-31-21-95:~# systemctl daemon-reload
root@ip-172-31-21-95:~# systemctl start kubelet
root@ip-172-31-21-95:~# systemctl enable kubelet.service
root@ip-172-31-21-95:~# sudo su -
root@ip-172-31-21-95:~# kubeadm init
root@ip-172-31-21-95:~# mkdir -p $HOME/.kube
root@ip-172-31-21-95:~# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
root@ip-172-31-21-95:~# sudo chown $(id -u):$(id -g) $HOME/.kube/config
root@ip-172-31-21-95:~# kubectl get pods -o wide -n kube-system NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES coredns-558bd4d5db-s482z 0/1 Pending 0 53s
coredns-558bd4d5db-xbhwf 0/1 Pending 0 53s
etcd-ip-172-31-21-95 1/1 Running 0 57s 172.31.21.95 ip-172-31-21-95
kube-apiserver-ip-172-31-21-95 1/1 Running 0 57s 172.31.21.95 ip-172-31-21-95
kube-controller-manager-ip-172-31-21-95 1/1 Running 0 58s 172.31.21.95 ip-172-31-21-95
kube-proxy-zqc4x 1/1 Running 0 53s 172.31.21.95 ip-172-31-21-95
kube-scheduler-ip-172-31-21-95 1/1 Running 0 57s 172.31.21.95 ip-172-31-21-95
root@ip-172-31-21-95:~# kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
NAME STATUS ROLES AGE VERSION ip-172-31-21-95 Ready control-plane,master 2m16s v1.21.2
root@ip-172-31-21-95:~# kubectl get pods --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-558bd4d5db-s482z 1/1 Running 0 2m27s kube-system coredns-558bd4d5db-xbhwf 1/1 Running 0 2m27s kube-system etcd-ip-172-31-21-95 1/1 Running 0 2m31s kube-system kube-apiserver-ip-172-31-21-95 1/1 Running 0 2m31s kube-system kube-controller-manager-ip-172-31-21-95 1/1 Running 0 2m32s kube-system kube-proxy-zqc4x 1/1 Running 0 2m27s kube-system kube-scheduler-ip-172-31-21-95 1/1 Running 0 2m31s kube-system weave-net-smk7l 2/2 Running 1 33s
oot@ip-172-31-21-95:~# kubectl get nodes NAME STATUS ROLES AGE VERSION ip-172-31-21-95 Ready control-plane,master 4m5s v1.21.2 ip-172-31-32-11 Ready 27s v1.21.2
ip-172-31-34-101 Ready 49s v1.21.2
root@ip-172-31-21-95:~# kubectl get nodes NAME STATUS ROLES AGE VERSION ip-172-31-21-95 Ready control-plane,master 6m7s v1.21.2 ip-172-31-32-11 Ready worker 2m29s v1.21.2 ip-172-31-34-101 Ready worker 2m51s v1.21.2
root@ip-172-31-21-95:~# kubectl get all -n kube-system NAME READY STATUS RESTARTS AGE pod/coredns-558bd4d5db-s482z 1/1 Running 0 7m53s pod/coredns-558bd4d5db-xbhwf 1/1 Running 0 7m53s pod/etcd-ip-172-31-21-95 1/1 Running 0 7m57s pod/kube-apiserver-ip-172-31-21-95 1/1 Running 0 7m57s pod/kube-controller-manager-ip-172-31-21-95 1/1 Running 0 7m58s pod/kube-proxy-qdb49 1/1 Running 0 4m23s pod/kube-proxy-zqc4x 1/1 Running 0 7m53s pod/kube-proxy-zrcmj 1/1 Running 0 4m45s pod/kube-scheduler-ip-172-31-21-95 1/1 Running 0 7m57s pod/weave-net-b44zv 2/2 Running 0 4m23s pod/weave-net-smk7l 2/2 Running 1 5m59s pod/weave-net-w942h 2/2 Running 0 4m45s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kube-dns ClusterIP 10.96.0.10 53/UDP,53/TCP,9153/TCP 7m58s
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
daemonset.apps/kube-proxy 3 3 3 3 3 kubernetes.io/os=linux 7m58s
daemonset.apps/weave-net 3 3 3 3 3 5m59s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/coredns 2/2 2 2 7m58s
NAME DESIRED CURRENT READY AGE
replicaset.apps/coredns-558bd4d5db 2 2 2 7m53s
root@ip-172-31-21-95:~# kubectl cluster-info Kubernetes control plane is running at https://172.31.21.95:6443 CoreDNS is running at https://172.31.21.95:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. ubuntu@ip-172-31-21-95:~$ cat javawebapppod.yml apiVersion: v1 kind: Pod metadata: name: javawebapppod labels: app: javawebapp spec: containers:
root@ip-172-31-21-95:~# kubectl apply -f javawebapppod.yml pod/javawebapppod created
oot@ip-172-31-21-95:~# kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES javawebapppod 1/1 Running 0 2m30s 10.36.0.1 ip-172-31-32-11
root@ip-172-31-21-95:~# kubectl get pods --show-labels NAME READY STATUS RESTARTS AGE LABELS javawebapppod 1/1 Running 0 4m12s app=javawebapp
root@ip-172-31-21-95:~# cat > javawebappsvc.yml apiVersion: v1 kind: Service metadata: name: javawebappsvc spec: type: ClusterIP selector: app: javawebapplication ports:
root@ip-172-31-21-95:~# kubectl get svc -o wide NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR kubernetes ClusterIP 10.96.0.1 443/TCP 15m
root@ip-172-31-21-95:~# kubectl get svc -o wide NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR javawebappsvc ClusterIP 10.111.240.61 80/TCP 7m40s app=javawebapp
kubernetes ClusterIP 10.96.0.1 443/TCP 24m
root@ip-172-31-21-95:~# kubectl describe svc javawebappsvc Name: javawebappsvc Namespace: default Labels:
Annotations:
Selector: app=javawebapp
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.111.240.61
IPs: 10.111.240.61
Port: 80/TCP
TargetPort: 8080/TCP
Endpoints: 10.36.0.1:8080
Session Affinity: None
Events:
root@ip-172-31-21-95:~# curl 10.111.240.61 curl: (7) Failed to connect to 10.111.240.61 port 80: No route to host
Anything else we need to know?
Versions:
Logs:
or, if using Kubernetes:
Network: