Unable to get the metrics from heapster pod in Kubernetes Cluster - kubernetes

I am trying to get the metrics in Kubernetes dashboard. For that I'm running the influxdb and heapster pod in my kube-system namespace. I checked the status of pods using the command kubectl get pods -n kube-system. Here is the link which I was followed But heapster shows the logs as
E1023 13:41:07.915723 1 reflector.go:190] k8s.io/heapster/metrics/util/util.go:30: Failed to list *v1.Node: Get https://kubernetes.default/api/v1/nodes?resourceVersion=0: dial tcp: i/o timeout
Could anybody suggest where might be I will do the changes in my configurations?

Looks like the heapster cannot talk to you kube-apiserver through the kubernetes service on your default namespace. A few of things, you can try:
Check that the service is defined in the default namespace:
$ kubectl get svc kubernetes
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 92d
Check that all your kube-proxy pods are running ok:
$ kubectl -n kube-system -l=k8s-app=kube-proxy get pods
NAME READY STATUS RESTARTS AGE
kube-proxy-xxxxx 1/1 Running 0 4d18h
...
Check that all your overlay pods are running. For example for calico
$ kubectl -n kube-system -l=k8s-app=calico-node get pods
NAME READY STATUS RESTARTS AGE
calico-node-88fgd 2/2 Running 3 4d21h
...

Related

After deploying Istio bookinfo application on EKS, `kubectl get svc` displays the app's services but `Kubectl get pods` returns `no resources found`

I installed Istio on my EKS cluster and installed bookinfo from samples.
$ sudo Kubectl apply -f /samples/bookinfo/platform/kube/bookinfo.yaml
After installation, I am able to see the services but not the pods for those services
$ sudo Kubectl get services
NAME. TYPE
productpage ClusterIP.
ratings. ClusterIP
reviews. ClusterIP
But the pods in the above services are not to be seen
$ sudo Kubectl get pods
No resources found in default namespace
Any idea why I can view the services but not the pods in those services installed by booking app?
I've verified the bookinfo app with istio 1.9.3 and it works correctly.
I went to the istio 1.9.3 directory with the following command cd istio-1.9.3 and used kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml to install the bookinfo application.
kubectl get pods
NAME READY STATUS RESTARTS AGE
details-v1-66b6955995-q2nwh 2/2 Running 0 44s
productpage-v1-5d9b4c9849-lhc2b 2/2 Running 0 44s
ratings-v1-fd78f799f-t8gkp 2/2 Running 0 43s
reviews-v1-6549ddccc5-jv2tg 2/2 Running 0 43s
reviews-v2-76c4865449-wjkxx 2/2 Running 0 43s
reviews-v3-6b554c875-9gsnd 2/2 Running 0 42s
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
details ClusterIP 10.112.2.127 <none> 9080/TCP 81s
kubernetes ClusterIP 10.112.0.1 <none> 443/TCP 6m41s
productpage ClusterIP 10.112.5.110 <none> 9080/TCP 75s
ratings ClusterIP 10.112.1.157 <none> 9080/TCP 79s
reviews ClusterIP 10.112.1.106 <none> 9080/TCP 78s
As you can see both pods and services were deployed correctly.
I would just recommend to redeploy the bookinfo application with the newest version and it should work.
Also you can use the raw.githubusercontent.com instead of the samples directory to deploy it. You can find more about that on istio documentation.

how to fix coredns service not found after initializing pod network

I started with Kubernetes tutorial and after intializeing the pod network
kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml
I discovered that coredns is pending but rest of the services were running.
# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-74ff55c5b-gzn5l 0/1 Pending 0 19m
kube-system coredns-74ff55c5b-k2h5m 0/1 Pending 0 19m
the I tried to look at the logs:
# kubectl logs coredns-74ff55c5b-gzn5l
Error from server (NotFound): pods "coredns-74ff55c5b-gzn5l" not found
# kubectl logs coredns-74ff55c5b-k2h5m
Error from server (NotFound): pods "coredns-74ff55c5b-k2h5m" not found

What happens when a service receives a request but has no ready pods?

Having a kubernetes service (of type ClusterIP) connected to a set of pods, but none of them are currently ready - what will happen to the request?
Will it:
fail eagerly
timeout
wait until a ready pod is available (or forever, whichever is earlier)
something else?
It will time out.
Kube-proxy pulls out the IP addresses from healthy pods and sets as endpoints of the service (backends). Also, note that all kube-proxy does is to re-write the iptables when you create, delete or modify a service.
So, when you send a request within your network and there is no one to reply, your request will timeout.
Deployed nginx service
[node1 ~]$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 443/TCP 2h
my-nginx ClusterIP 10.100.1.134 80/TCP 9s
$ curl 10.100.1.134
curl: (7) Failed connect to 10.100.1.134:80; Connection refused
Deployed nginx deployment
$ kubectl create -f nginx-depl.yaml
$ kubectl get po
NAME READY STATUS RESTARTS AGE
my-nginx-f9945ffdd-2f77f 1/1 Running 0 1m
my-nginx-f9945ffdd-rk68v 1/1 Running 0 1m
$ curl 10.100.1.134
Welcome to nginx!
most likely you would get Connection refused error

How to get the endpoint for kubernetes-dashboard

I have installed kubernetes using minikube on ubuntu 16.04 machine.
I have also installed kubernetes-dashboard.
When i try accessing the dashboard i get
Waiting, endpoint for service is not registered yet
Waiting, endpoint for service is not ready yet...
Waiting, endpoint for service is not ready yet...
Waiting, endpoint for service is not ready yet...
.....
Could not find finalized endpoint being pointed to by kubernetes-dashboard: Temporary Error: Endpoint for service is not ready yet
Temporary Error: Endpoint for service is not ready yet
Temporary Error: Endpoint for service is not ready yet
Temporary Error: Endpoint for service is not ready yet
Temporary Error: Endpoint for service is not ready yet
Temporary Error: Endpoint for service is not ready yet
`
However, when i try a kubectl get pods --all namespacesi get the below output
kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system kube-addon-manager-minikube 1/1 Running 0 11m
kube-system kube-dns-1301475494-xtb3b 3/3 Running 0 8m
kube-system kubernetes-dashboard-2039414953-dvv3m 1/1 Running 0 9m
kube-system kubernetes-dashboard-2crsk 1/1 Running 0 8m
kubectl get endpoints --all-namespaces
NAMESPACE NAME ENDPOINTS AGE
default kubernetes 10.0.2.15:8443 11m
kube-system kube-controller-manager <none> 6m
kube-system kube-dns 172.17.0.4:53,172.17.0.4:53 8m
kube-system kube-scheduler <none> 6m
kube-system kubernetes-dashboard <none> 9m
How can i fix this issue? I don't seem to understand what is wrong. I am completely new to kubernetes
You need to run minikube dashboard. You shouldn't install dashboard separately; it comes with minikube.
some of the minikube commands
./minikube.exe version
./minikube.exe delete
./minikube.exe start --help
./minikube get-k8s-versions
./minikube.exe status
./minikube.exe ip
./minikube.exe dashboard --url=true

How do I expose the Kubernetes UI Dashboard?

Per the documentation at: https://kubernetes.io/docs/tasks/web-ui-dashboard/
I ran :
kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
Then I tried running this to expose the service
cluster/kubectl.sh expose svc/kubernetes
but I keep getting an error:
error: couldn't retrieve selectors via --selector flag or introspection: the service has no pod selector set
See 'kubectl expose -h' for help and examples.
I have looked at the examples but can't understand what I am doing wrong.
kubernetes# cluster/kubectl.sh get all
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
svc/kubernetes 10.0.0.1 <none> 443/TCP 7h
kubernetes# cluster/kubectl.sh get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system kube-dns-806549836-r6wtk 0/3 Pending 0 7h
kube-system kubernetes-dashboard-2396447444-9675d 0/1 Pending 0 6h
To get access to the dashboard, usually you would just type:
kubectl cluster-info
Which then gives you all the required urls for accessing your cluster.