Unable to connect to Kubernetes from Ubuntu 20.04 (deployed in Azure)

I work on Ubuntu OS.

For a while, I worked with Kubernetes from the command line and through the Lens utility. But now I get errors:

  • command line

kubectl get pods
Unable to connect to the server: EOF

  • lens

name_vpn_server
Authentication proxy started

http: proxy error: EOF

502 - undefined

It all started with the fact that the name of the server on which the cluster is deployed (this is the Azure cloud) was not allowed.

I did the following:

  • I installed
sudo apt update
sudo apt install openvpn-systemd-resolved
  • I addes in end file *.ovpn

script-security 2
up /etc/openvpn/update-systemd-resolved
down /etc/openvpn/update-systemd-resolved
down-pre

  • I corrected a file hosts
ip_to_gateway_vpn_server *****************.azmk8s.io  
  • I checked whether the server name is resolved correctly, by the specified IP
nslookup  *****************.azmk8s.io   ip_to_gateway_vpn_server

Yes. Everything works now.

  • I checked the ping.
ping  *****************.azmk8s.io
  • checked the dns status
systemd-resolve --status

Link 8 (tun0)
Current Scopes: DNS
DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: ip_to_gateway_vpn_server
DNS Servers: ip_to_gateway_vpn_server

It works the same way.

I can work on the Internet.
Configuration file in in
.kube / config
has a token.
I can switch namespace from the command line. There is access to a VPN. I can go to the nexus repository.

I switched to another network, Lens writes this:

http: proxy error: dial tcp ip_vpn_server:443: i/o timeout

``

> apiVersion: v1
> clusters:
> - cluster:
>     certificate-authority-data: DATA+OMITTED
>     server: https://**********************:443
>   name: ******************
> contexts:
> - context:
>     cluster: ********
>     namespace: ****
>     user: clusterUser_****************
>   name: *******************
> current-context: ***************
> kind: Config
> preferences: {}
> users:
> - name: clusterUser_***************
>   user:
>     client-certificate-data: REDACTED
>     client-key-data: REDACTED
>     token: REDACTED

kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:“1”, Minor:“24”, GitVersion:“v1.24.0”, GitCommit:“4ce5a8954017644c5420bae81d72b09b735c21f0”, GitTreeState:“clean”, BuildDate:“2022-05-03T13:46:05Z”, GoVersion:“go1.18.1”, Compiler:“gc”, Platform:“linux/amd64”}
Kustomize Version: v4.5.4
Unable to connect to the server: EOF



Maybe who knows what the problem is ?    How can this be fixed ?

### Cluster information:

Kubernetes version: lastversion