kubernetes-tutorial
kubernetes-tutorial copied to clipboard
Operators Tutorial - Pizza Operator GET request to Kubernetes API fails
Reproduction Steps
I followed these steps in the Operators tutorial:
kubectl create namespace pizzahat kubectl config set-context --current --namespace=pizzahat
kubectl apply -f apps/pizzas/pizza-crd.yaml kubectl apply -f apps/pizzas/pizza-deployment.yaml
Output of kubectl get pods -n pizzahat
Output of kubectl describe pod
To get more information, I tailed the pod.
Output of stern -n pizzahat pod/quarkus-operator-example-...
Investigation
I believe the URL is incorrect. More specifically, the authorization header should be included (or fixed somewhere in the Pizza Operator code), and v1beta1 should be v1.
Here are my steps for arriving at that conclusion:
-
Slightly modify
apps/pizzas/pizza-deployment. I override the container's entrypoint so that I can get a shell: -
From inside the container, I
curlthe Kubernetes API.I executed the following commands:
KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)curl -sSk -H "Authorization: Bearer $KUBE_TOKEN" https://10.152.183.1:443/apis/apiextensions.k8s.io/v1/customresourcedefinitionsThis works.