This file contains hidden or 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
| from kubernetes import client, config | |
| import os,sys,json | |
| NAMESPACE=sys.argv[1] | |
| DEPLOYMENT=sys.argv[2] | |
| def GetClaimDetails(DEPLOYMENT,volume): | |
| print("Workload details",DEPLOYMENT) | |
| print("Pod details",DEPLOYMENT) | |
| print("Persistent Volume Claim Name:",volume["name"]) |
This file contains hidden or 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
| apiVersion: rbac.authorization.k8s.io/v1 | |
| kind: ClusterRole | |
| metadata: | |
| name: cleaner | |
| rules: | |
| - apiGroups: [""] | |
| resources: ["pods","namespaces"] | |
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | |
| --- | |
| apiVersion: rbac.authorization.k8s.io/v1 |
This file contains hidden or 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
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: nodeSelectorApp | |
| namespace: default | |
| spec: | |
| containers: | |
| - name: nodeSelectorApp | |
| image: nginx | |
| nodeSelector: |
This file contains hidden or 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
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: nodenameapp | |
| namespace: default | |
| spec: | |
| containers: | |
| - name: nodenameapp | |
| image: nginx | |
| nodeName: multi-node-cluster-worker |
This file contains hidden or 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
| kind: Cluster | |
| apiVersion: kind.x-k8s.io/v1alpha4 | |
| nodes: | |
| - role: control-plane | |
| image: kindest/node:v1.18.19@sha256:7af1492e19b3192a79f606e43c35fb741e520d195f96399284515f077b3b622c | |
| - role: worker | |
| image: kindest/node:v1.18.19@sha256:7af1492e19b3192a79f606e43c35fb741e520d195f96399284515f077b3b622c | |
| - role: worker | |
| image: kindest/node:v1.18.19@sha256:7af1492e19b3192a79f606e43c35fb741e520d195f96399284515f077b3b622c | |
| - role: worker |
This file contains hidden or 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
| kind: Cluster | |
| apiVersion: kind.x-k8s.io/v1alpha4 | |
| nodes: | |
| - role: control-plane | |
| - role: worker | |
| - role: worker | |
| - role: worker |
This file contains hidden or 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
| cd /tmp | |
| curl -L "https://github.com/kubernetes-sigs/kind/releases/download/v0.12.0/kind-linux-arm64" -o /usr/local/bin/kind | |
| chmod +x /usr/local/bin/kind | |
| which kind | |
| kind version |
This file contains hidden or 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
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: deployment | |
| spec: | |
| replicas: 1 | |
| selector: | |
| matchLabels: | |
| app: nginx | |
| template: |
This file contains hidden or 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
| #!/bin/bash | |
| server=HOSTNAME | |
| service_account='basic-user' | |
| namespace='policy-checker' | |
| cluster_name=CLUSTER_NAME | |
| secret_name=$(kubectl get sa/$service_account -n $namespace -o jsonpath='{.secrets[0].name}') | |
| ca=$(kubectl get secret/$secret_name -n $namespace -o jsonpath='{.data.ca\.crt}') | |
| token=$(kubectl get secret/$secret_name -n $namespace -o jsonpath='{.data.token}' | base64 --decode) | |
| echo " |
This file contains hidden or 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
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: my-app | |
| namespace: policy-check | |
| spec: | |
| replicas: 1 | |
| selector: | |
| matchLabels: | |
| name: my-app |