Kubectl port-forward not working with IBM Cluster - kubernetes

When I do Kubernetes port-forward with IBM cluster I get connection refused. I have access to other clusters like Azure Kubernetes Service and kubectl port-forward is working fine there. Also when I get a pod log using kubectl logs {pod_name} I get TLS handshake error but the other kubernetes commands like get pod and describe pod is working fine.

Related

Cannot get nodes using kubectl get nodes with gcloud shell

My GCP GKE cluster is connected to the Rancher (v 2.3.3) but it shows unavailable with the msg:
Failed to communicate with API server: Get https://X.x.X.x:443/api/v1/namespaces/kube-system?timeout=30s: waiting for cluster agent to connect
When I try to connect to the GCP K8s Cluster via gcloudshell I cannot retrieve any info with command: kubectl get nodes !!
Any idea why it is happening ... all workloads and services are running and green, only Ingress stuff is with warning info some of them with Unhealthy status from the backend services. But first need to know how can I troubleshoot the problem with connectivity to the k8s cluster with gcloud or rancher !!

What is the 'minikube ip' equivalent on k3d

Hi I'm really new in kubernetes and I'm playing around with minikube and deployed a nginx server successfully, executing minikube ip I'm able to get the deployed application ip and access to it via browser or give it an alias in hosts file.
And now I'm playing around with k3d and I noticed that there is no equivalent command to get that ip for my nginx deployed application, how can I get that ip?
You can retrieve the exposed IP on the traefik service (on the kube-system namespace)
kubectl get -n kube-system service/traefik -o jsonpath="{.status.loadBalancer.ingress[0].ip}"

Not able to access application running on kubernetes pod (Using Docker-Desktop: Single-node cluster)

See below service is running:
and Below error i am getting while trying to access it:
Kubectl get pods:
Yaml files:
Service:
Deployment:
Check pod status if it's running or not.
Also, you can try with port-forwarding to POD
kubectl port-forward <POD name> 8086:8086 & open localhost:8086

Exposing kubernetes service locally (without minikube)

I'm using lxc/lxd to play with the kubenetes cluster.
Is there a way to expose a deployed service locally without using minikube, so that I could access it from the local machine?
I can access it from any of the nodes in the cluster but not from outside.
Do you want to acccess the pod being served by the service? if yes, you can use kubectl port-forward to connect to your pod and access it locally
Here is an example:
If you have a service which forwards all the requests to a pod ( nginx ) at port number 80 you can configure it to your local port as follows
kubectl port-forward -n default nginx-5767f4d585-hgtfj 8081:80
Here is the syntax of the same
kubectl port-forward -n NAMESPACE ${POD} local-port:pod-port
If you want to connect to your service directly, you need to do it via kubectl proxy
Here is a reference
Hope it helps.

I have deployed kubernetes cluster. The issue i have is that the dashboard is not accessible from external desktop system

I have deployed kubernetes cluster. The issue i have is that the dashboard is not accessible from external desktop system.
Following is my setup.
Two vm's with cluster deployed, one master one node.
dashboard running without any issue the kube-dns is also working as expected.
kubernetes version is 1.7.
Issue: When trying to access dashboard externally through kubectl proxy. i get unauthorized response.
This is with rbac role and rolebindings enabled.
How to i configure the cluster for http browser access to dashboard from external system.
Any hint/suggestions are most welcome.
kubectl proxy not working > 1.7
try this:
copy ~/.kube/config file to your desktop
then run the kubect like this
export POD_NAME=$(kubectl --kubeconfig=config get pods -n kube-system -l "app=kubernetes-dashboard,release=kubernetes-dashboard" -o jsonpath="{.items[0].metadata.name}")
echo http://127.0.0.1:9090/
kubectl --kubeconfig=config -n kube-system port-forward $POD_NAME 9090:9090
Then access the ui like this: http://127.0.0.1:9090
see this helps
If kubectl proxy gives the Unauthorized error, there can be 2 reasons:
Your user cert doesn't have the appropriate permissions. This is unlikely since you successfully deployed kube-dns and the dashboard.
kubelet authn/authz is enabled and it's not setup correctly. See the answer to my question.