krustlet icon indicating copy to clipboard operation
krustlet copied to clipboard

fail to work with snap microk8s

Open huang12zheng opened this issue 2 years ago • 0 comments

cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
 kubectl get nodes
node1   Ready    <none>   28d   v1.24.0-2+59bbb3530b6769
KUBECONFIG=~/.krustlet/config/kubeconfig \
  krustlet-wasi \
  --node-ip=127.0.0.1 \
  --node-name=krustlet \
  --bootstrap-file=${HOME}/.krustlet/config/bootstrap.conf
Error: ApiError: Unauthorized: Unauthorized (ErrorResponse { status: "Failure", message: "Unauthorized", reason: "Unauthorized", code: 401 })

Caused by:
    Unauthorized: Unauthorized

I noticed that you can find the startup args in/var/snap/microk8s/current/args/kube - apiserver https://docs.krustlet.dev/howto/krustlet-on-microk8s/

tail /var/snap/microk8s/current/args/kube-apiserver
--requestheader-client-ca-file=${SNAP_DATA}/certs/front-proxy-ca.crt
--requestheader-allowed-names=front-proxy-client
--requestheader-extra-headers-prefix=X-Remote-Extra-
--requestheader-group-headers=X-Remote-Group
--requestheader-username-headers=X-Remote-User
--proxy-client-cert-file=${SNAP_DATA}/certs/front-proxy-client.crt
--proxy-client-key-file=${SNAP_DATA}/certs/front-proxy-client.key
#~Enable the aggregation layer

--enable-bootstrap-token-auth

but

ps -ef | grep kube-apiserver | grep "enable-bootstrap-token-auth"

show none, and krustlet still not work

huang12zheng avatar Jul 15 '22 10:07 huang12zheng