Skip to content

Instantly share code, notes, and snippets.

@nathmahale
Last active August 28, 2023 12:10
Show Gist options
  • Save nathmahale/4dd93f47b22c3aee852aa87358e9cfd5 to your computer and use it in GitHub Desktop.
Save nathmahale/4dd93f47b22c3aee852aa87358e9cfd5 to your computer and use it in GitHub Desktop.
handy_commands
## get initial admin password
kubectl -n argocd get secrets argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d
## login to argocd server with cli
argocd login $(kubectl -n argocd get svc argocd-server --output=jsonpath='{.spec.clusterIP}') --insecure --username admin --password "<PASSWORD>" --insecure
## change service to NodePort
kubectl patch svc kubernetes-dashboard -n kubernetes-dashboard -p '{"spec": {"type": "NodePort"}}'
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
## set admin password, install apache2-utils package
kubectl patch secret -n argocd argocd-secret -p '{"stringData": { "admin.password": "'$(htpasswd -bnBC 10 "" <PASSWORD> | tr -d ':\n')'"}}'
## Credits : https://www.howtogeek.com/816878/how-to-back-up-and-restore-gpg-keys-on-linux/
## generate new GPG key
gpg --full-generate-key
## list keys in long format
gpg --list-secret-keys --keyid-format=long
## test gpg key
export GPG_TTY=$(tty)
echo "test" | gpg --clearsign
## export gpg public block
gpg --armor --export <publicKeyID>
## export public keys
gpg --export --export-options backup --output public.gpg
## export private keys, enter passphrase if provided during key creation
gpg --export-secret-keys --export-options backup --output private.gpg
## export trust relationships
gpg --export-ownertrust > trust.gpg
## import public keys
gpg --import public.gpg
## import private keys, enter passphrase if provided during key creation
gpg --import private.gpg
## import trust relationships
gpg --import-ownertrust trust.gpg
#!/bin/bash
## install kind cluster
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
chmod +x kind && sudo mv ./kind /usr/local/bin/kind
## kubectl for x86_64
[ $(uname -m) = x86_64 ] && curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
## kubectl for arm64
[ $(uname -m) = arm64 ] && curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
[user]
name = <userID>
email = <userMail>
signingkey = <publicKeyID>
[commit]
gpgsign = true
#!/bin/bash
msg=$1
function add_files() {
echo "added all the files"
git add --all
}
function commit_message() {
echo "committed with the message --> ${msg}"
git commit -m "${msg}"
}
function push_remote() {
echo "pushed to remote"
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
}
add_files
commit_message
push_remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment