【错误解决】kubernetes 1.21.10 apiserver报错 Error: [service-account-issuer is a required flag

报错日志

Error: [service-account-issuer is a required flag, --service-account-signing-key-file and --service-account-issuer are required flags]

解决办法

生成sa证书和pub

cat< /root/k8s/certs/sa-csr.json 
{
    "CN":"sa",
    "key":{
        "algo":"rsa",
        "size":2048
    },
    "names":[
        {
            "C":"CN",
            "L":"BeiJing",
            "ST":"BeiJing",
            "O":"k8s",
            "OU":"System"
        }
    ]
}
EOF

# 此处修改自己的路径
cfssl gencert -initca /root/k8s/certs/sa-csr.json  | cfssljson -bare /root/k8s/certs/sa -

openssl x509 -in /root/k8s/certs/sa.pem -pubkey -noout > /root/k8s/certs/sa.pub

# 修改apiserver的参数
 --service-account-key-file=/root/k8s/certs/sa.pub
--service-account-signing-key-file=/root/k8s/certs/sa-key.pem
--service-account-issuer=api

你可能感兴趣的:(云计算,kubernetes,容器,云原生)