apiVersion: v1beta3
kind: Pod
Metadata:
name: MysqL
labels:
name: MysqL
spec:
containers:
- resources:
limits :
cpu: 1
image: MysqL
name: MysqL
env:
- name: MysqL_ROOT_PASSWORD
# change this
value: yourpassword
ports:
- containerPort: 3306
name: MysqL
运行kubectl create -f MysqL.yaml会给出错误:
Error from server: error when creating "MysqL.yaml": Pod "Unknown" is forbidden: no API token found for service account default/default,retry after the token is automatically created and added to the service account
我有一个主机和一个节点,都是centos 7.1.
最佳答案
为了使您的设置正常工作,您可以执行local-up-cluster.sh相同的操作:
>生成签名密钥:
openssl genrsa -out /tmp/serviceaccount.key 2048
>更新/ etc / kubernetes / apiserver:
KUBE_API_ARGS =“-service_account_key_file = / tmp / serviceaccount.key”
>更新/ etc / kubernetes / controller-manager:
KUBE_CONTROLLER_MANAGER_ARGS =“-service_account_private_key_file = / tmp / serviceaccount.key”
从https://github.com/kubernetes/kubernetes/issues/11355#issuecomment-127378691