Kubernetes API를 통한 모든 작업
로그 스키마: KRM API
감사 정보가 포함된 로그 항목의 필드 | ||
---|---|---|
감사 메타데이터 | 감사 필드 이름 | 값 |
사용자 또는 서비스 ID | user |
"user": { "groups": [ "system:authenticated" ], "username": "fop-platform-admin@example.com" }, "annotations": { "authorization.k8s.io/decision": "allow", "authorization.k8s.io/reason": "RBAC: allowed by ClusterRoleBinding \"project-creator-binding\" of ClusterRole \"project-creator\" to Group \"system:authenticated\"" } |
대상 (API를 호출하는 필드 및 값) |
objectRef |
"objectRef": { "apiVersion": "v1", "name": "app1-project", "resource": "projects", "namespace": "gpc-system", "apiGroup": "resourcemanager.gdc.goog" } |
작업 (실행된 작업을 포함하는 필드) |
verb |
"verb": "create" |
이벤트 타임스탬프 | requestReceivedTimestamp |
"requestReceivedTimestamp": "2022-12-09T23:51:56.997825Z" |
작업 소스 | sourceIPs |
"sourceIPs": [ "10.200.0.2" ] |
결과 | responseStatus |
"responseStatus": { "code": 403, "status": "Failure", "metadata": {}, "message": "admission webhook \"validation.gatekeeper.sh\" denied the request: [restrictprojectaccess] username |
기타 필드 | responseStatus_message |
"responseStatus": { "code": 403, "status": "Failure", "metadata": {}, "message": "admission webhook \"validation.gatekeeper.sh\" denied the request: [restrictprojectaccess] username |
KRM API 로그 예
{
"sourceIPs": [
"10.200.0.2"
],
"_gdch_cluster": "root-admin",
"objectRef": {
"apiVersion": "v1",
"name": "app1-project",
"resource": "projects",
"namespace": "gpc-system",
"apiGroup": "resourcemanager.gdc.goog"
},
"kind": "Event",
"level": "Metadata",
"apiVersion": "audit.k8s.io/v1",
"auditID": "3611358c-f8b0-4780-9268-950eccc5881a",
"stage": "ResponseComplete",
"requestURI": "/apis/resourcemanager.gdc.goog/v1/namespaces/gpc-system/projects?fieldManager=kubectl-client-side-apply&fieldValidation=Strict",
"verb": "create",
"requestReceivedTimestamp": "2022-12-09T23:51:56.997825Z",
"responseStatus": {
"code": 403,
"status": "Failure",
"metadata": {},
"message": "admission webhook \"validation.gatekeeper.sh\" denied the request: [restrictprojectaccess] username <fop-platform-admin@example.com> with groups <[\"system:authenticated\"]> is not allowed for this resource <Project/app1-project>",
"reason": "[restrictprojectaccess] username <fop-platform-admin@example.com> with groups <[\"system:authenticated\"]> is not allowed for this resource <Project/app1-project>"
},
"_gdch_fluentbit_pod": "anthos-audit-logs-forwarder-b9kk4",
"stageTimestamp": "2022-12-09T23:51:57.015134Z",
"userAgent": "kubectl/v1.25.4 (linux/amd64) kubernetes/872a965",
"user": {
"groups": [
"system:authenticated"
],
"username": "fop-platform-admin@example.com"
},
"annotations": {
"authorization.k8s.io/decision": "allow",
"authorization.k8s.io/reason": "RBAC: allowed by ClusterRoleBinding \"project-creator-binding\" of ClusterRole \"project-creator\" to Group \"system:authenticated\""
},
"_gdch_service_name": "apiserver"
}
감사 절차 시작
로그 스키마: 게이트키퍼
감사 정보가 포함된 로그 항목의 필드 | ||
---|---|---|
감사 메타데이터 | 감사 필드 이름 | 값 |
사용자 또는 서비스 ID | 해당 없음 | |
대상 (API를 호출하는 필드 및 값) |
process |
\"process\":\"audit\" |
작업 (실행된 작업을 포함하는 필드) |
event_type |
\"event_type\":\"audit_started\" |
이벤트 타임스탬프 | audit_id |
\"audit_id\":\"2022-12-13T23:07:11Z\" |
작업 소스 | pod_name |
"pod_name": "gatekeeper-audit-b7 65495d8-tb4kc" |
Outcome | msg |
\"msg\":\"auditing constraints and violations\"
|
기타 필드 | 해당 없음 |
감사 프로세스 완료
로그 스키마: 게이트키퍼
감사 정보가 포함된 로그 항목의 필드 | ||
---|---|---|
감사 메타데이터 | 감사 필드 이름 | 값 |
사용자 또는 서비스 ID | 해당 없음 | |
대상 (API를 호출하는 필드 및 값) |
process |
\"process\":\"audit\" |
작업 (실행된 작업을 포함하는 필드) |
event_type |
\"event_type\":\"audit_finished\" |
이벤트 타임스탬프 | audit_id |
\"audit_id\":\"2022-12-13T23:05:32Z\" |
작업 소스 | pod_name |
"pod_name": "gatekeeper-audit-b765495d8-tb4k c" |
Outcome | msg |
\"msg\":\"auditing is complete\"
|
기타 필드 | 해당 없음 |
감사 위반
로그 스키마:Gatekeeper
감사 정보가 포함된 로그 항목의 필드 | ||
---|---|---|
감사 메타데이터 | 감사 필드 이름 | 값 |
사용자 또는 서비스 ID | details |
\"details\":{\"missing_labels\":[\"gatekeeper\"]} |
대상 (API를 호출하는 필드 및 값) |
process |
\"process\":\"audit\" |
작업 (실행된 작업을 포함하는 필드) |
event_type |
\"event_type\":\"violation_audited\" |
이벤트 타임스탬프 | audit_id |
\"audit_id\":\"2022-12-13T23:07:11Z\" |
작업 소스 | pod_name |
"pod_name": "gatekeeper-audit-b765495d8-tb4kc" |
결과 | msg |
\"msg\":\"you must provide labels: {\\\"gatekeeper\\\"}\" |
기타 필드 | 해당 없음 |
제약 조건 감사
로그 스키마: 게이트키퍼
감사 정보가 포함된 로그 항목의 필드 | ||
---|---|---|
감사 메타데이터 | 감사 필드 이름 | 값 |
사용자 또는 서비스 ID | constraint_name |
\"constraint_name\":\"ns-must-have-gk\" |
대상 (API를 호출하는 필드 및 값) |
process |
\"process\":\"audit\" |
작업 (실행된 작업을 포함하는 필드) |
event_type |
\"event_type\":\"constraint_audited\" |
이벤트 타임스탬프 | audit_id |
\"audit_id\":\"2022-12-13T23:07:11Z\" |
작업 소스 | pod_name |
"pod_name": "gatekeeper-audit-b 765495d8-tb4kc" |
결과 | msg |
\"msg\":\"audit results for constraint\" |
기타 필드 | 해당 없음 |
로그 게이트키퍼 예시
{
"stream":"stderr",
"logtag":"F",
"log":"{
\"level\":\"info\",
\"ts\":1670972934.0394588,
\"logger\":\"controller\",
\"msg\":\"audit results for constraint\",
\"process\":\"audit\",
\"audit_id\":\"2022-12-13T23:07:11Z\",
\"event_type\":\"constraint_audited\",
\"constraint_group\":\"constraints.gatekeeper.sh \",
\"constraint_api_version\":\"v1\",
\"constraint_kind\":\"K8sRequiredLabels\",
\"constraint_name\":\"ns-must-have-gk\",
\"constraint_namespace\":\"\",
\"constraint_action\":\"deny\",
\"constraint_status\":\"enforced\",
\"constraint_violations\":\"64\"
}",
"kubernetes":{
"pod_name": "gatekeeper-audit-b 765495d8-tb4kc",
"namespace_name":"gatekeeper-system",
"pod_id":"3c75b257-0917-4575-bb69-ab5eb6f5839d",
"labels":{
"app": "gatekeeper",
"chart": "gatekeeper",
"control-plane":"audit-controller",
"gatekeeper.sh/operation":"audit",
"gatekeeper.sh/system": "yes",
"heritage" : "Helm",
"pod-template-hash": "b765495d 8",
"release":"gatekeeper"
},
"host": "gpc-adhoc-2801b240vm-worker-node2",
"container_name": "manager",
"docker_id":"33f7eb658cb7a17c50ce917dcc727628bc40ea7d160fb1a20d0d61ae4e51b473",
"container_hash": "gcr.io/private-cloud-staging/gatekeeper@sha256:5d91735b2378723a74930cdff2298efeea6f6bebc8ea9dd0106bfdb067f5a07d", "container_image": "gcr.io/private-cloud-staging/gatekeeper: v3.7.0"
},
"_gdch_tenant_id":"infra-obs"
}