Skip to content

kubectl cmd from kritis preinstall auth failure #589

Description

@perezjasonr

Expected Behavior

successful kubectl call from within kritis preinstall container

Actual Behavior

kubectl logs kritis-preinstall -c kritis-preinstall
time="2020-11-27T20:37:54Z" level=info msg="contents of /var/run/secrets/kubernetes.io/serviceaccount/namespace: default"
time="2020-11-27T20:37:54Z" level=info msg="running preinstall\nversion v0.2.2\ncommit: bea073f2a2f299af94363dc399b7780fde8f2afc"
The connection to the server 10.96.0.1:443 was refused - did you specify the right host or port?
The connection to the server 10.96.0.1:443 was refused - did you specify the right host or port?
time="2020-11-27T20:37:54Z" level=info msg="[cfssl genkey -]"
time="2020-11-27T20:37:54Z" level=info msg="{\"csr\":\"-----BEGIN CERTIFICATE REQUEST-----\\n<redacted>-----END CERTIFICATE REQUEST-----\\n\",\"key\":\"-----BEGIN EC PRIVATE KEY-----\\n<redacted>\\n-----END EC PRIVATE KEY-----\\n\"}\n"
apiVersion: certificates.k8s.io/v1beta1
kind: CertificateSigningRequest
metadata:
    name: tls-webhook-secret-cert
    labels:
        kritis.grafeas.io/install: ""
spec:
    groups:
    - system:authenticated
    request: <redacted>
    usages:
    - digital signature
    - key encipherment
    - server auth
time="2020-11-27T20:37:54Z" level=info msg="[cfssljson -bare server]"
time="2020-11-27T20:37:54Z" level=info
time="2020-11-27T20:37:54Z" level=info msg="[kubectl apply -f -]"
time="2020-11-27T20:37:54Z" level=info
time="2020-11-27T20:37:54Z" level=error msg="error: unable to recognize \"STDIN\": Get https://10.96.0.1:443/api?timeout=32s: dial tcp 10.96.0.1:443: connect: connection refused\n"
time="2020-11-27T20:37:54Z" level=fatal msg="exit status 1"

Steps to Reproduce the Problem

Environment, commands

I used the standalone docs, im really interested in this toolchain so demo-ing for my team.

./setup_grafeas.sh
./setup_kritis.sh

Additional info

basically, it seems like the kubectl call isn't authorized. Do see the service account exists:

 kubectl get sa
NAME                               SECRETS   AGE
...
...
kritis-preinstall-serviceaccount   1         27m

as is its clusterrolebinding:

kubectl get clusterrolebinding
NAME                                                   ROLE
                  AGE
...
...
kritis-preinstall-clusterrolebinding                   ClusterRole/cluster-admin

but I cant tell by looking at the golang (im a beginner/intermediate at golang at best) where its getting its kubeconf from or if its trying to use the service account token. It is noteworthy that other things I'm running that have an SA and require kube-api access arent being rejected. Any ideas?

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