Skip to content

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

Description

@a37tam

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions