-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: Kubernetes | ||
weight: 11 | ||
--- | ||
|
||
Kubectl alias (replace `<project>`, `<project>`, `<region>`, and `<namespace>`): | ||
|
||
```bash | ||
alias kprod='gcloud config set project <project>; gcloud container clusters get-credentials <project> --region <region>; kubectl config set-context --current --namespace=<namespace>' | ||
``` | ||
|
||
Delete all Trivy vulnerability reports: | ||
|
||
```bash | ||
kubectl get vulnerabilityreports.aquasecurity.github.io | awk '{print $1}' | xargs kubectl delete vulnerabilityreports.aquasecurity.github.io | ||
``` | ||
|
||
Search for specific vulnerability (replace `<vuln-to-search-for>`): | ||
|
||
```bash | ||
kubectl get vulnerabilityreports.aquasecurity.github.io -o json | jq -c .items[].report.vulnerabilities[] | grep <vuln-to-search-for> | jq -rc "[.resource,.installedVersion,.title]" | sort | uniq | ||
``` | ||
|
||
Set node label (replace `<nodename>` and `<label>` (eg `app=static-rdf`)): | ||
|
||
```bash | ||
kubectl get nodes --show-labels | ||
kubectl label nodes <nodename> <label> | ||
``` |