yum install -y bash-completion
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
1).我遇到的错是:- --iface=*
不能匹配所有机器,更改yaml文件
$ vi kube-flannel.yml
...
containers:
- name: kube-flannel
image: 10.168.1.232:5000/coreos/flannel:v0.11.0-amd64
command:
- /opt/bin/flanneld
args:
- --ip-masq
- --kube-subnet-mgr
- --iface=ens33 # 节点1的网卡
- --iface=ens32 # 节点2的网卡把所有机器的网卡都列举出来
resources:
requests:
cpu: "100m"
...
2).更改flannel网络为host-g模式
#修改flannel的网络
$ kubectl edit cm kube-flannel-cfg -n kube-system
# 删除网络pod,自动重建
$ kubectl -n kube-system delete pod kube-flannel-ds-amd64-4thh5 kube-flannel-ds-amd64-85qsn kube-flannel-ds-amd64-92znh
$ kubectl -n kube-system get pod
删除Rancher依赖的namespace(cattle-system),状态一直是Terminating。无法重新添加
[root@kuiper-master kubernetes]# kubectl get namespace
NAME STATUS AGE
cattle-fleet-system Active 29d
cattle-impersonation-system Active 29d
cattle-system Active 29d
default Active 30d
dev Active 25d
ingress-nginx Active 28d
istio-system Active 15d
jenkins Active 27d
kube-node-lease Active 30d
kube-public Active 30d
kube-system Active 30d
local Active 29d
logging Active 29d
monitor Active 28d
mps-cloud Active 5d23h
test Active 16d
kubectl patch namespace cattle-system -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
kubectl delete namespace cattle-system --grace-period=0 --force
kubectl patch namespace cattle-global-data -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
kubectl delete namespace cattle-global-data --grace-period=0 --force
kubectl patch namespace local -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
for resource in `kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -o name -n local`; do kubectl patch $resource -p '{"metadata": {"finalizers": []}}' --type='merge' -n local; done
kubectl delete namespace local --grace-period=0 --force
docker image prune
docker image prune -a
$ docker image prune -a --filter "until=24h"
ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%cpu | head