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

After implementing argocd-k8s-auth seeing Connection closed early in gke audit logs #9794

Closed
rwong2888 opened this issue Jun 27, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@rwong2888
Copy link
Contributor

As per, 9786

We see the same GKE Audit logs after migrating to argocd-k8s-auth and the message shows Connection closed early.

cc @toVersus

@rwong2888 rwong2888 added the bug Something isn't working label Jun 27, 2022
@toVersus
Copy link
Contributor

toVersus commented Jul 2, 2022

I looked into this and found that those audit logs are normal and not harmful. I think we can close this issue.

At first, those logs are generated here and intended to record a long running request (i.e. watch API). I’m not a person in GKE team, so the only thing I can do is guessing from the sample Audit policy here. The default level is set to Metadata, and the kube-apiserver log request metadata without request and response body. As you know, the Argo CD application controller is calling watch API for available resources, so Connection closed early messages are logged. I’m not sure why those logs are not written when using argocd-manager service account in kube-system namespace, but I doubt that the requests authenticating with GCP service account are targeted.

I found other controller in a similar situation. The following is the audit logs for watch API called by GKE internal controllers with GCP internal service account:

{
  "protoPayload": {
    "@type": "type.googleapis.com/google.cloud.audit.AuditLog",
    "authenticationInfo": {
      "principalEmail": "service-********************@container-engine-robot.iam.gserviceaccount.com"
    },
    "authorizationInfo": [
      {
        "granted": true,
        "permission": "io.k8s.apiextensions.v1.customresourcedefinitions.watch",
        "resource": "apiextensions.k8s.io/v1/customresourcedefinitions"
      }
    ],
    "methodName": "io.k8s.apiextensions.v1.customresourcedefinitions.watch",
    "requestMetadata": {
      "callerIp": "xx.xx.xx.xx",
      "callerSuppliedUserAgent": "GoogleGKEGatewayController"
    },
    "resourceName": "apiextensions.k8s.io/v1/customresourcedefinitions",
    "serviceName": "k8s.io",
    "status": {
      "code": 0,
      "message": "Connection closed early"
    }
  },
  "resource": {
    "type": "k8s_cluster"
  },
  "labels": {
    "authorization.k8s.io/decision": "allow",
    "authorization.k8s.io/reason": "access granted by IAM permissions."
  },
  "logName": "projects/gcp-xxxxxxx/logs/cloudaudit.googleapis.com%2Factivity"
}

@rwong2888
Copy link
Contributor Author

Thanks for the detailed analysis @toVersus ! Closing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants