How can kubectl acces k8s cluster in another server - kubernetes

I tried to create a k8s cluster in my MacBook Pro M1, but fail because of M1. So I want to create the k8s in another windows and the MacBook will connect to the cluster with kubectl and telepresenc.
create a k8s cluster in the ubuntu server 20.04 which is in the vmware of windows 10.
in my MacBook, use kubectl and telepresence to access the k8s cluster.
I use microk8s to manage the k8s.
The problem is when I access k8s in windows, I fail and was tell that I can only access the k8s through 127.0.0.1 or 192.168.23.130 but not 192.168.10.11.
How can I solve the problem or achive this structure with another method.

Related

Running oauth2-proxy kubernetes locally on wsl using minikube?

Hey I was just trying to set-up a local kubernetes environment on wsl using minikube.
But i constantly struggling in using oauth2-proxy because of the redirect-urls and dns problems. I couldn't find a redirect solution using localhost, and also i couldn't access
http://oauth2proxy.namespace.svc.cluster.local/
from my windows machine.
Port-forwarding for via kubectl port-forward specific port does work but i still left with the host-ip:port and not the required dns name

Using helm and a Kubernetes Cluster with Microk8s on one or two local physical Ubuntu server

I installed Microk8s on a local physical Ubuntu 20-04 server (without a GUI):
microk8s status --wait-ready
microk8s is running
high-availability: no
datastore master nodes: 127.0.0.1:19001
datastore standby nodes: none
addons:
enabled:
ha-cluster # Configure high availability on the current node
helm # Helm 2 - the package manager for Kubernetes
disabled:
When I try to install something with helm it says:
Error: INSTALLATION FAILED: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp 127.0.0.1:8080: connect: connection refused
What configuration has to be done to use the MicroK8s Kubernetes cluster for helm installations?
Do I have to enable more MicroK8s services for that?
Can I run a Kubernetes cluster on one or two single local physical Ubuntu server with MicroK8s?
Searching for solution for your issue, I have found this one. Try to run:
[microk8s] kubectl config view --raw > ~/.kube/config
Helm interacts directly with the Kubernetes API server so it needs to be able to connect to a Kubernetes cluster. Helms reads the same configuration files used by kubectl to do it automatically.
Based on Learning Helm by O'Reilly Media:
Helm will try to find this information by reading the environment variable $KUBECONFIG. If that is not set, it will look in the same default locations that kubectl looks in.
See also:
This discussion about similar issue on Github
This similar issue

How to connect to a minikube cluster created in a linux VM from windows 10 local computer?

I have created a following minikube cluster in linux machine . Now I wanted to connect to the node of the cluster from my local windows 10 machine. I have kubectl installed in the local machine. How do I connect the worker node of a minikube cluster from my windows machine? I am new to the Kubes , please let me know if any details needs to added to the question.
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane,master 52d v1.22.3
minikube-m02 Ready worker 49m v1.22.3
minikube-m03 Ready worker 43m v1.22.3
Deploying a Nginx reverse proxy in front of a minikube can make us interact from local machines to the Virtual machine where the minikube is installed.
You can’t access minikube remotely because it’s only accessible locally. For this reason, you need to deploy an Nginx reverse proxy next to minikube that will allow receiving requests from remote clients then forward them to kube-apiserver. Kubernetes API server is a point where all your requests will go when you use the command-line tool kubectl. The kubectl allows you to run commands against Kubernetes clusters.
Refer this document for the detailed procedure of installing Nginx reverse proxy in front of a minikube.

Statefulset Pod connect service slow

I run my app in Kubernetes with helm. Everything is fine in my environment. But a strange event has happened in my customer environment.
I have some Deployments and one StatefulSet
I deployed postgresql using https://github.com/helm/charts/tree/master/stable/postgresql, and run only one pod (postgresql-0).
My Deployment pod1 connect with postgresql using psql and need a few milliseconds only.
My StatefulSet pod1 connect with postgresql using psql and need more than 10 seconds.
Now only one master (No schedule) and one node. All my pods run in the same node.I think they are using docker0 brige?
I used flannel.
What is the difference between Deployments pod network and StatefulSet pod network? Why the same connection commands have so different costs? How can I fix it?
Environment:
Kubernetes version (use $ kubectl version): v1.12.1
Cloud provider or hardware configuration:
OS (e.g. from /etc/os-release): Centos 7.6
Kernel (e.g. uname -a):
Install tools: kubeadm
Others:

How to enable Network Policies in Docker for Mac with Kubernetes

Is there an easy way to enable Network Policies in single-node k8s cluster managed by Docker Desktop for Mac?
A single-node k8s cluster managed by Docker Desktop for Mac is imply a VM provisioned by the Docker for Mac Daemon that is then bootstrapped with a Kubernetes cluster. Docker has extended this solution in some ways to make it easier for developers to use but it is effectively similar to using Minikube.
A NetworkPolicy is a Kubernetes resource and as you have discovered, it is not enabled in your environment by default. This is because the NetworkPolicy resource requires a controller to be installed to enabled the enforcement of NetworkPolicy rules after they have been declared. Many applications can be installed to provide this functionality. The most common way is by installing a CNI like Calico.
After you do this, Calico will be able to enforce your NetworkPolicy rules that you have defined. They will automatically move from the Pending to Ready state in the cluster.