kubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0
- Top 30 folders directories disk space sorted by size desc
du -h | sort -rh | head -30
- Find a particular file or dir in current dir recursively
find . -name "darwin_amd64" -type d -print0
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
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
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
import boto3 | |
import os | |
import json | |
filename = 'data.json' | |
kms_id = '' | |
secretdata= {"username":"chris","password":"BnQw!XDWgaEeT9XGTT29"} | |
secret_data={} | |
for k,v in secretdata.items(): | |
encrypt_string = os.popen(("aws kms encrypt --key-id %s --plaintext '%s' --query CiphertextBlob --output text" % (kms_id, v))).read() | |
secret_data[k] = encrypt_string |
Put the following in github webhook section:
https://jenkins.example.com/v1/generic-webhook-trigger/invoke?token=my-token&apiKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
where :
apiKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
is for API Gateway api key
token=my-token
is same as configured in Jenkins job
- Get the context :
CONTEXT=$(kubectl config current-context)
- Create the required service account and cluster role binding :
apiVersion: v1
kind: ServiceAccount
metadata:
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
# cluster.yaml | |
# A cluster with managed nodegroup | |
# Setup aws profile if you have many: | |
# `export AWS_PROFILE=test` | |
# `export AWS_DEFAULT_PROFILE=test` | |
# Run the command: | |
# `eksctl create cluster -f cluster.yaml --write-kubeconfig --set-kubeconfig-context` | |
--- | |
apiVersion: eksctl.io/v1alpha5 | |
kind: ClusterConfig |
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
<!DOCTYPE NETSCAPE-Bookmark-file-1> | |
<!-- This is an automatically generated file. | |
It will be read and overwritten. | |
DO NOT EDIT! --> | |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | |
<TITLE>Bookmarks</TITLE> | |
<H1>Bookmarks</H1> | |
<DL><p> | |
<DT><H3 ADD_DATE="1578057396" LAST_MODIFIED="0" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3> | |
<DL><p> |
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
Questions are not from any actual exam!!! | |
Q: Create a secret that has the following username password data: | |
username=missawesome | |
password=123kube321 | |
Create a pod running nginx that has access to those data items in a volume mount path at /tmp/secret-volume | |
log into the nginx pod you created and list the items and cat the output of the data items to a file "credentials.txt" |
NewerOlder