サーバー 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/fstabswap.img行を含む行を削除したことです。その後、サーバーを再起動すると、すべてが正常に戻りました。

おすすめ記事