openGauss operator实战环境准备(二)之疑难问题

2024年 6月 3日 50.9k 0

上一篇:openGauss operator实战-环境准备(一)

疑难问题

1)Exiting due tO GUEST MISSING CONNTRACK: Sorry, Kubernetes 1.20.2 requires conntrack to be installed in root’s path

问题现象

# minikube start --driver=none--network-plugin=cni --cni=calico
minikube v1.20.0 on centos 7.6.1810
Using the none driver based on user configuration
Exiting due tO GUEST MISSING CONNTRACK: Sorry, Kubernetes 1.20.2 requires conntrack to be installed in root's path

openGauss operator实战-环境准备(二)之疑难问题-1

解决

yum -y install conntrack

2)连不上外网导致拉取相关镜像失败

现象

💢 initialization failed, will try again: wait: /bin/bash -c "sudo env PATH=/var/lib/minikube/binaries/v1.20.2:$PATH kubeadm init --config /var/tmp/minikube/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--var-lib-minikube,DirAvailable--var-lib-minikube-etcd,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap,Mem": exit status 1
stdout:
[init] Using Kubernetes version: v1.20.2
...
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-apiserver:v1.20.2: output: Error response from daemon: Get "https://k8s.gcr.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
, error: exit status 1
[ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-controller-manager:v1.20.2: output: Error response from daemon: Get "https://k8s.gcr.io/v2/": dial tcp 108.177.125.82:443: i/o timeout
, error: exit status 1
[ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-scheduler:v1.20.2: output: Error response from daemon: Get "https://k8s.gcr.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
, error: exit status 1
...

原因

启动时需要拉取镜像,访问外网失败导致

解决方法

手动拉取所需镜像

#1.脚本文件
# cat kubeadm.sh
#!/bin/bash

## 使用如下脚本下载国内镜像,并修改tag为google的tag
set -e

KUBE_VERSION=v1.20.2
KUBE_PAUSE_VERSION=3.2
ETCD_VERSION=3.4.13-0
CORE_DNS_VERSION=1.7.0

GCR_URL=k8s.gcr.io
ALIYUN_URL=registry.aliyuncs.com/google_containers

images=(kube-proxy:${KUBE_VERSION}
kube-scheduler:${KUBE_VERSION}
kube-controller-manager:${KUBE_VERSION}
kube-apiserver:${KUBE_VERSION}
pause:${KUBE_PAUSE_VERSION}
etcd:${ETCD_VERSION}
coredns:${CORE_DNS_VERSION})

for imageName in ${images[@]} ; do
docker pull $ALIYUN_URL/$imageName
docker tag $ALIYUN_URL/$imageName $GCR_URL/$imageName
docker rmi $ALIYUN_URL/$imageName
done

#2.执行
# sh kubeadm.sh

#3.查看镜像
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
opengauss-5.0.2 latest 11b49a372af4 46 hours ago 2.12GB
openeuler-20.03-lts-sp3 latest 12d0b819f478 2 years ago 189MB
k8s.gcr.io/kube-proxy v1.20.2 43154ddb57a8 3 years ago 118MB
k8s.gcr.io/kube-controller-manager v1.20.2 a27166429d98 3 years ago 116MB
k8s.gcr.io/kube-apiserver v1.20.2 a8c2fdb8bf76 3 years ago 122MB
k8s.gcr.io/kube-scheduler v1.20.2 ed2c44fbdd78 3 years ago 46.4MB
k8s.gcr.io/etcd 3.4.13-0 0369cf4303ff 3 years ago 253MB
k8s.gcr.io/coredns 1.7.0 bfe3a36ebd25 3 years ago 45.2MB
k8s.gcr.io/pause 3.2 80d28bedfe5d 4 years ago 683kB

3)pod不断重启,状态异常:Unable to auto-detect an IPv4 address using interface regexes [eth.*]: no valid host interfaces found

问题现象

# kubectl get pods -l k8s-app=calico-node -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-node-wb2m4 0/1 CrashLoopBackOff 6 9m18s

问题排查

1)查看pod日志
openGauss operator实战-环境准备(二)之疑难问题-2

2)查看本地网卡

openGauss operator实战-环境准备(二)之疑难问题-3

3)检查calico是否开启自动检测IPV4地址:

openGauss operator实战-环境准备(二)之疑难问题-4

问题原因很清楚了,calico会根据默认的eth.*网卡名的匹配规自动检测,找不到相关的网卡,自动分配IP自然也会报错,需要修改calico的IPV4网卡匹配规则

解决办法
  • 法一:改网卡名

# 命令修改
kubectl set env daemonset/calico-node -n kube-system IP_AUTODETECTION_METHOD=interface=ens*,eth.*
或者
# 修改配置文件
kubectl edit daemonset calico-node -n kube-system

  • 法二:手动指定IP

kubectl set env daemonset/calico-node -n kube-system IP=192.170.3.100/24

再次查看pod状态:

# kubectl get pods -l k8s-app=calico-node -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-node-phwth 0/1 Running 0 13s
# kubectl get pods -l k8s-app=calico-node -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-node-phwth 1/1 Running 0 5m10s

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论