Skip to content

K8s operator unable to funnel #11556

Closed
Closed

Description

@rmblau

Hi all, I am trying to get the k8s operator to funnel correctly and am having some difficulty. I am running the latest unstable version as I had some networking issues that were resolved in that version. However, I am now getting this error regardless of which version of the operator I use.

boot: 2024/03/29 12:43:02 error checking get permission on secret ts-longhorn-funnel-5hsd6-0: Post "https://kubernetes.default.svc/apis/authorization.k8s.io/v1/selfsubjectaccessreviews": context deadline exceeded
boot: 2024/03/29 12:43:02 error checking update permission on secret ts-longhorn-funnel-5hsd6-0: Post "https://kubernetes.default.svc/apis/authorization.k8s.io/v1/selfsubjectaccessreviews": context deadline exceeded
boot: 2024/03/29 12:43:02 error checking patch permission on secret ts-longhorn-funnel-5hsd6-0: Post "https://kubernetes.default.svc/apis/authorization.k8s.io/v1/selfsubjectaccessreviews": context deadline exceeded
boot: 2024/03/29 12:43:02 Starting tailscaled
boot: 2024/03/29 12:43:02 Waiting for tailscaled
socket
boot: 2024/03/29 12:43:02 Timed out waiting for tailscaled socket

I am not sure how to troubleshoot this and any tips or guidance would be great! Thank you!

Activity

  1. irbekrm commented on Mar 29, 2024

    @irbekrm
    Contributor

    Hi @rmblau

    boot: 2024/03/29 12:43:02 error checking get permission on secret ts-longhorn-funnel-5hsd6-0: Post "https://kubernetes.default.svc/apis/authorization.k8s.io/v1/selfsubjectaccessreviews": context deadline exceeded

    This seems to be the proxy not being able to reach Kubernetes API server.
    Is the API server reachable on kubernetes.default.svc in your cluster and, if yes, can you confirm that you can reach it from a Pod in the tailscale namespace?

  2. rmblau commented on Mar 29, 2024

    @rmblau
    Author

    Hi @rmblau

    boot: 2024/03/29 12:43:02 error checking get permission on secret ts-longhorn-funnel-5hsd6-0: Post "https://kubernetes.default.svc/apis/authorization.k8s.io/v1/selfsubjectaccessreviews": context deadline exceeded

    This seems to be the proxy not being able to reach Kubernetes API server.
    Is the API server reachable on kubernetes.default.svc in your cluster and, if yes, can you confirm that you can reach it from a Pod in the tailscale namespace?

    @irbekrm as best that I can tell is that the cluster is accessible via tailscale. I'm using k3s and I have it joined to my tailnet. This used to work and then I had the issue that you resolved yesterday and it hasn't worked since. I'm fairly new to k8s. How can I get you the information you requested? The API server address appears to be a tailscale address as far as I can tell.

  3. irbekrm commented on Mar 29, 2024

    @irbekrm
    Contributor

    boot: 2024/03/29 12:43:02 error checking get permission on secret ts-longhorn-funnel-5hsd6-0: Post "https://kubernetes.default.svc/apis/authorization.k8s.io/v1/selfsubjectaccessreviews": context deadline exceeded

    This is the Tailscale proxy Pod itself trying to reach the Kubernetes API server on a Service name that is (most likely) internal to the cluster.
    You could exec to the proxy Pod and see if you can reach it:

    $ kubectl exec -it ts-longhorn-funnel-5hsd6-0 -n tailscale sh
    $ apk add curl
    $ curl -vv -k https://kubernetes.default.svc/healthz
    

    Let us know what the output is.
    Also, could you try it with the unstable-v1.63.61 tag if possible? That would be v1.63.1 Helm chart version from the tailscale-dev repository if you are installing with Helm.

  4. rmblau commented on Mar 29, 2024

    @rmblau
    Author

    boot: 2024/03/29 12:43:02 error checking get permission on secret ts-longhorn-funnel-5hsd6-0: Post "https://kubernetes.default.svc/apis/authorization.k8s.io/v1/selfsubjectaccessreviews": context deadline exceeded

    This is the Tailscale proxy Pod itself trying to reach the Kubernetes API server on the a Service name that is (most likely) internal to the cluster.
    You could exec to the proxy Pod and see if you can reach it:

    $ kubectl exec -it ts-longhorn-funnel-5hsd6-0 -n tailscale sh
    $ apk add curl
    $ curl -vv -k https://kubernetes.default.svc/healthz
    

    @irbekrm

    * Host kubernetes.default.svc:443 was resolved.
    * IPv6: (none)
    * IPv4: 10.43.0.1
    *   Trying 10.43.0.1:443...
    * Connected to kubernetes.default.svc (10.43.0.1) port 443
    * ALPN: curl offers h2,http/1.1
    * TLSv1.3 (OUT), TLS handshake, Client hello (1):* TLSv1.3 (IN), TLS handshake, Server hello (2):
    * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
    * TLSv1.3 (IN), TLS handshake, Request CERT (13):* TLSv1.3 (IN), TLS handshake, Certificate (11):
    * TLSv1.3 (IN), TLS handshake, CERT verify (15):
    * TLSv1.3 (IN), TLS handshake, Finished (20):
    * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
    * TLSv1.3 (OUT), TLS handshake, Certificate (11):* TLSv1.3 (OUT), TLS handshake, Finished (20):
    * SSL connection using TLSv1.3 / TLS_CHACHA20_POLY1305_SHA256 / X25519 / id-ecPublicKey
    * ALPN: server accepted h2
    * Server certificate:
    *  subject: O=k3s; CN=k3s
    *  start date: Mar 18 10:12:59 2024 GMT
    *  expire date: Mar 27 09:05:37 2025 GMT
    *  issuer: CN=k3s-server-ca@1710756779
    *  SSL certificate verify result: self-signed certificate in certificate chain (19), continuing anyway.
    *   Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA256
    *   Certificate level 1: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA256
    * TLSv1.3 (IN), TLS handshake, Newsession Ticket
    (4):
    * using HTTP/2
    * [HTTP/2] [1] OPENED stream for https://kubernetes.default.svc/healthz
    * [HTTP/2] [1] [:method: GET]
    * [HTTP/2] [1] [:scheme: https]
    * [HTTP/2] [1] [:authority: kubernetes.default.svc]
    * [HTTP/2] [1] [:path: /healthz]
    * [HTTP/2] [1] [user-agent: curl/8.5.0]
    * [HTTP/2] [1] [accept: */*]
    > GET /healthz HTTP/2
    > Host: kubernetes.default.svc
    > User-Agent: curl/8.5.0
    > Accept: */*
    >
    < HTTP/2 401
    < audit-id: e9da3dc1-9dfb-476a-8bde-fa30fdf2383b
    < cache-control: no-cache, private
    < content-type: application/json
    < content-length: 157
    < date: Fri, 29 Mar 2024 14:54:20 GMT
    <
    {
      "kind": "Status",
      "apiVersion": "v1",
      "metadata": {},
      "status": "Failure",
      "message": "Unauthorized",
      "reason": "Unauthorized",
      "code": 401
    * Connection #0 to host kubernetes.default.svc left intact
    ``` I got this from the operator pod as the funnel pod keeps crashing. 
    
  5. irbekrm commented on Mar 29, 2024

    @irbekrm
    Contributor

    Is that a single node cluster? If not, is the proxy Pod scheduled on the same node as the operator?
    Also, do you have access the Kubernetes API server? Perhaps there is something in the API server logs?

    context deadline exceeded

    Unfortunately, this is a very vague message, so it could be any number of cluster issues.

    The request that the proxy Pod makes is essentially:

    curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <contents of /var/run/secrets/kubernetes.io/serviceaccount/token in the proxy Pod> https://kubernetes.default.svc/apis/authorization.k8s.io/v1/s
    elfsubjectaccessreviews -d '{"apiVersion": "authorization.k8s.io/v1","kind":"SelfSubjectAccessReview", "spec":{"resourceAttributes": {"namespace":"tailscale","verb":"patch","resource":"secrets","name":"secret-name"}
    }}'
    

    if there is nothing in the API server logs or you cannot access them, as a next step you could try to create another Pod in tailscale namespace, preferably scheduled on the same Node as the failing proxy Pod with proxies ServiceAccount, try to exec to that and see if you can run that curl. Let us know how it goes

  6. rmblau commented on Mar 31, 2024

    @rmblau
    Author

    Is that a single node cluster? If not, is the proxy Pod scheduled on the same node as the operator?
    Also, do you have access the Kubernetes API server? Perhaps there is something in the API server logs?

    context deadline exceeded

    Unfortunately, this is a very vague message, so it could be any number of cluster issues.

    The request that the proxy Pod makes is essentially:

    curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <contents of /var/run/secrets/kubernetes.io/serviceaccount/token in the proxy Pod> https://kubernetes.default.svc/apis/authorization.k8s.io/v1/s
    elfsubjectaccessreviews -d '{"apiVersion": "authorization.k8s.io/v1","kind":"SelfSubjectAccessReview", "spec":{"resourceAttributes": {"namespace":"tailscale","verb":"patch","resource":"secrets","name":"secret-name"}
    }}'
    

    if there is nothing in the API server logs or you cannot access them, as a next step you could try to create another Pod in tailscale namespace, preferably scheduled on the same Node as the failing proxy Pod with proxies ServiceAccount, try to exec to that and see if you can run that curl. Let us know how it goes

    @irbekrm I have created a pod in the same namespace on the same node as the failing pod and it gives me the same authorization required error. I've reset iptables and reinstalled k3s on that node and the error persists. I've been able to do an nslookup and get back info on the API server but that's about it. Any guidance would be appreciated.

  7. rmblau commented on Apr 2, 2024

    @rmblau
    Author

    @irbekrm I have figured out the issue. It would appear that the second node fell off of tailscale. After rejoining the node to tailscale it has been able to funnel consistently. Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions