K8S使用问题与解决方式
一、 Kubectl create -f test.yaml遇到 No API token found for service account "default"错误
配置serviceaccounts
openssl genrsa -out /etc/kubernetes/serviceaccount.key 2048
编辑/etc/kubernetes/apiserver
KUBE_API_ARGS="--service_account_key_file=/etc/kubernetes/serviceaccount.key"
编辑/etc/kubernetes/controller-manager
KUBE_CONTROLLER_MANAGER_ARGS="--service_account_private_key_file=/etc/kubernetes/serviceaccount.key"
重启服务
systemctl restart etcd kube-apiserver kube-manager kube-scheduler
二、创建pod不成功
kubectl create -f test.yaml后创建的pods
通过kubectl get pod 发现是一直创建 状态
通过kubectl describe pod 发出是有”image pull failed for registry.access.redhat.com/rhel7/pod-infrastructure:latest”
这个是因为 缺少证书,安装
yum -y install *rhsm* wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm rpm2cpio python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm | cpio -iv --to-stdout ./etc/rhsm/ca/redhat-uep.pem | tee /etc/rhsm/ca/redhat-uep.pem