Skip to content

Instantly share code, notes, and snippets.

View harivemula's full-sized avatar

Hari Krishna Vemula harivemula

View GitHub Profile
@harivemula
harivemula / login_aws_tkg.md
Last active June 17, 2020 15:20
SSH to TKG clusters in AWS EC2

SSH to TKG clusters in AWS EC2

Change the private key permission

chmod 400 aws-privkey.pem

Use the below command to get into a node via bastion host

ssh -o ProxyCommand='ssh -i <yourawsprivatekey.pem> -W %h:%p ubuntu@<bastion-host-ip>' -i <yourawsprivatekey.pem> ec2-user@<Node-IP>

You may create a ssh config for aliases

Enable SSH in Ubuntu 18.04

Install openssh server if not already installed.

sudo apt update
sudo apt install openssh-server

Check the status of the openssh-server, it should show Active: active (Running)

Creating a Helm Chart using helm3 for an application.

Install helm (version >3.x) cli, Follow the steps described in this link.

Run the below command to ensure the version.

$ helm version --short

Go to the directory where you would like to create the chart. Run the below command, which creates chart with pre-defined templates. Use the name of the chart as your application/module name.

Mount New Disk to Ubuntu 18.04

  • Check the attached disks by using below command, verify the space df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            491M     0  491M   0% /dev
tmpfs           103M  771k  102M   1% /run
/dev/xvda1      8.3G  1.2G  7.1G  15% /
tmpfs           514M     0  514M   0% /dev/shm
tmpfs           5.3M     0  5.3M   0% /run/lock
#!/bin/bash -e
# version: 1.0
# Generate kubeconfig file from service account token
# Usage ./k8s-sa-kubeconfig.sh <namespace> <service account name>
TEMPDIR=$( mktemp -d )
trap "{ rm -rf $TEMPDIR ; exit 255; }" EXIT
@harivemula
harivemula / tkgi-admin-scope-fix.md
Last active February 23, 2021 14:24
Fix TKGi UAA admin user scope by DB method

NOTE: don't use this method if you have alternate way to fix it by using any other user with clients.write scope

If you have removed uaa.admin scope from TKGi 'admin' user, here are the steps to fix it by db method

  • bosh -d <pks...> ssh pks-db/0
  • sudo su -
  • mysql --socket=/var/vcap/sys/run/pxc-mysql/mysqld.sock -u uaa -p
  • <password should be from TKGi tile 'Cf Mysql Uaa Db Password'>
  • use uaa;
@harivemula
harivemula / ssh-to-supervisor-or-guest-cluster-node.sh
Created April 5, 2021 04:44
Login to Supervisor cluster Nodes / Guest Cluster Nodes - vSphere with Tanzu
# *Supervisor Cluster*
# Login to vCenter server and run the below command to retrieve the Supervisor cluster IP and password
/usr/lib/vmware-wcp/decryptK8Pwd.py
# Use the username as 'root' and password provided by above command to login to Supervisor node(s).
# IP returned by above commmand is VIP of cluster api servers.
ssh root@<supervisor-node-ip>
### *Guest Clusters*
@harivemula
harivemula / handling_multiple_github_accounts.md
Created May 6, 2021 02:11 — forked from Jonalogy/handling_multiple_github_accounts.md
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@harivemula
harivemula / convert_mov_to_mp4.sh
Created May 16, 2021 05:26
Convert mov files to mp4 in a directory using ffmpeg in mac
## zsh
brew install ffmpeg
## If you have any spaces in file name, run below command to replace
#
for FILE in *.mov; do mv "$FILE" `echo $FILE | tr ' ' '_'` ; done
## If you are running from a different directory, you may use ${FILE:t:r} to just keep the filename without path and extension
@harivemula
harivemula / cert-manager-gcp-nginx.md
Last active June 1, 2023 12:44
Installing Cert manager in GCP GKE cluster on Nginx Ingress.

Installing & Configuring 'cert-manager' on GKE cluster with Nginx ingres

Confirm before running the below for installing ingress (nginx)

  • helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
  • helm install quickstart ingress-nginx/ingress-nginx

Install a sample service

  • kubectl apply -f https://netlify.cert-manager.io/docs/tutorials/acme/example/deployment.yaml
  • kubectl apply -f https://netlify.cert-manager.io/docs/tutorials/acme/example/service.yaml