Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operators Tutorial - Pizza Operator GET request to Kubernetes API fails #58

Open
a37tam opened this issue Jun 5, 2023 · 0 comments
Open

Comments

@a37tam
Copy link

a37tam commented Jun 5, 2023

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
image

Output of kubectl describe pod
image

To get more information, I tailed the pod.

Output of stern -n pizzahat pod/quarkus-operator-example-...
image

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:
    image

  • From inside the container, I curl the 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/customresourcedefinitions

    This works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant