2024年9月12日(k8s环境及测试 常用命令)

一、环境准备及测试

1、报错处理:
kube-system   calico-node-5wvln                          0/1     Init:0/3            0               16h
kube-system   calico-node-d7xfb                          0/1     Init:0/3            0               16h
kube-system   calico-node-k84tc                          0/1     Init:0/3            0               16h

执行以下命令:更新内核版本

yum list kernel

yum update kernel

reboot

如果是cni报错,需要上传下面两个文件,然后重启

一直不成功挂起状态

再/etc/cni/net.d/中上传文件

kube-system   calico-node-5wvln                          0/1     Init:0/3            0             16h
kube-system   calico-node-d7xfb                          0/1     Init:0/3            0             16h
kube-system   calico-node-k84tc                          1/1     Running             0             16h
[root@k8s-master ~]# kubectl get nodes
NAME         STATUS   ROLES           AGE   VERSION
k8s-master   Ready    control-plane   16h   v1.28.2
k8s-node1    Ready    <none>          16h   v1.28.2
k8s-node2    Ready    <none>          16h   v1.28.2

现在就合适了

 kubectl 无法补全报错ku-bash: _get_comp_words_by_ref: command not found

[root@k8s-master ~]# yum -y install bash-completion
[root@k8s-master ~]# bash /usr/share/bash-completion/bash_completion
[root@k8s-master ~]# bash

2、测试:

创建nginx镜像名称为nginx0

[root@k8s-master ~]# kubectl run nginx0 --image=nginx:latest
pod/nginx0 created
[root@k8s-master ~]# kubectl get po -Aowide

default       nginx0                                     0/1     ContainerCreating   0             29s   <none>          k8s-node2    <none>           <none>

查看日志

[root@k8s-master ~]# kubectl logs nginx0 
Error from server (BadRequest): container "nginx0" in pod "nginx0" is waiting to start: ContainerCre

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值