Skip to content

Instantly share code, notes, and snippets.

View harivemula's full-sized avatar

Hari Krishna Vemula harivemula

View GitHub Profile
@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 / 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;
#!/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

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

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.

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)

@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