서버 192.168.1.2:6443에 대한 연결이 거부되었습니다. - 올바른 호스트 또는 포트를 지정했습니까?

서버 192.168.1.2:6443에 대한 연결이 거부되었습니다. - 올바른 호스트 또는 포트를 지정했습니까?

내 컴퓨터에 Kubernetes를 설치하고 실행하려고 합니다 Ubuntu 22.04LTS. 따라 설치했어요여기kubectl get pods하지만 시도하면 다음과 kubectl get nodes같은 오류가 발생합니다.


E1210 10:35:25.649853   16219 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1210 10:35:25.650138   16219 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1210 10:35:25.651789   16219 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1210 10:35:25.653224   16219 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1210 10:35:25.654932   16219 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
The connection to the server 192.168.1.2:6443 was refused - did you specify the right host or port?

인터넷에서 검색하고 많은 솔루션을 시도했지만 그 중 아무 것도 효과가 없었습니다!

결과 kubectl config view:

    apiVersion: v1
    clusters:
    - cluster:
        certificate-authority-data: DATA+OMITTED
        server: https://192.168.1.2:6443
      name: kubernetes
    contexts:
    - context:
        cluster: kubernetes
        user: kubernetes-admin
      name: kubernetes-admin@kubernetes
    current-context: kubernetes-admin@kubernetes
    kind: Config
    preferences: {}
    users:
    - name: kubernetes-admin
      user:
        client-certificate-data: DATA+OMITTED
        client-key-data: DATA+OMITTED

문서 /etc/containerd/config.toml내용:

#   Copyright 2018-2022 Docker Inc.

#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at

#       http://www.apache.org/licenses/LICENSE-2.0

#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

#disabled_plugins = ["cri"]
#root = "/var/lib/containerd"
#state = "/run/containerd"
#subreaper = true
#oom_score = 0

#[grpc]
#  address = "/run/containerd/containerd.sock"
#  uid = 0
#  gid = 0

#[debug]
#  address = "/run/containerd/debug.sock"
#  uid = 0
#  gid = 0
#  level = "info"

[plugins]
  [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]

  [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
      SystemdCgroup = true


  [plugins."io.containerd.grpc.v1.cri"]
  sandbox_image = "registry.k8s.io/pause:3.2"

콘텐츠 sudo nano $HOME/.kube/config:

  GNU nano 6.2                  /home/a/.kube/config                            
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakN>
    server: https://192.168.1.2:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQW>
    client-key-data: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb2dJQkFBS0>

답변1

Ubuntu 22.04에서도 동일한 문제가 발생했습니다. 확인해 보니 /var/log/syslog교환성이 다시 활성화된 것으로 나타났습니다.

내가 한 일은 파일을 편집 /etc/fstab하고 swap.img 줄이 포함된 줄을 삭제한 것입니다. 그 후 서버를 다시 시작하면 모든 것이 정상으로 돌아왔습니다.

관련 정보