jpetazzo / ampernetacle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to connect to the server

keinou opened this issue · comments

after succesful i get the error, when execute kubectl get nodes (windows):
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

my kubeconfig generated is:
apiVersion: v1
clusters:

  • cluster:
    server: https://xxxxxxxxxx:6443
    name: kubernetes
    contexts: null
    current-context: ""
    kind: Config
    preferences: {}
    users: null

data.external.kubeconfig: Reading...
data.external.kubeconfig: Read complete after 7s [id=-]
local_file.kubeconfig: Creating...
local_file.kubeconfig: Provisioning with 'local-exec'...
local_file.kubeconfig (local-exec): Executing: ["cmd" "/C" "kubectl --kubeconfig=kubeconfig config set-cluster kubernetes --server=https://xxxxxxx:6443"]
local_file.kubeconfig (local-exec): Cluster "kubernetes" set.
local_file.kubeconfig: Creation complete after 0s [id=da39a3ee5e6b4b0d3255bfef95601890afd80709]

Apply complete! Resources: 12 added, 0 changed, 0 destroyed.

Outputs:

ssh-with-k8s-user = <<EOT

In linux:

null_resource.wait_for_kube_apiserver (local-exec): curl: (7) Failed to connect to xxxxxxxx port 6443 after 56 ms: No route to host
null_resource.wait_for_kube_apiserver (local-exec):   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
null_resource.wait_for_kube_apiserver (local-exec):                                  Dload  Upload   Total   Spent    Left  Speed
null_resource.wait_for_kube_apiserver (local-exec):   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
null_resource.wait_for_kube_apiserver (local-exec):   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

if I connect to the server, I can see that there was an error when adding the repository:

Err:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
  404  Not Found [IP: 142.250.218.206 443]
Reading package lists... Done
E: Failed to fetch https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-arm64/by-hash/SHA256/5b7cf78e291230a16a5ea18f69ad7144df2cbd573da4518bcedef03df4e1b973  404  Not Found [IP: 142.250.218.206 443]
E: Some index files failed to download. They have been ignored, or old ones used instead.

Mate, i solve this removing one line of the cloudinit.tf
I will send a PR when i have time but if you need to use go to my fork

This new PR solves my problem.

I'm having the same problem, I removed "apt-transport-https" but it didn't fix it :(

The kubeconfig file seems incomplete.

Well, I just did a big upgrade to support Kubernetes 1.26; feel free to try again and let me know if that works better!