DevOps Tips

Truong, articles
Back

Tip 1

As a DevOps Engineer you will be using Linux a lot, and you may have several remote servers that you accessing with ssh , for that you will need something like this to do so:

$ sudo ssh -i key.pem user@host -p <port>

In order to make you life easier you could whether use a tool like Remmina in linux or stick to the default shell and add the ssh entries you have into ~/.ssh/config as below:

  Host web
     KeepAlive yes
     IdentityFile ~/.ssh/web_id_rsa
     HostName www.example.com
     Port 2222
     User webusr
     ForwardX11 no

Also don't forget to allow access to non root users to the directory ~/.ssh as follows:

$ sudo chmod -R ~/.ssh

After this you will be able to access your server just by hitting

$ ssh web

Tip 2

Kubectl is the main tool for interacting with kuberenets clusters, as a DevOps person you will be using a lot kubectl commands, a good way to make things more easier for you is by setting up bash-completion and use bash aliases

Install bash-completion

$ sudo apt-get install bash-completion

or

$ sudo yum install bash-completion

Reload your run and shell

$ type _init_completion

Add bash-completion to bashrc

echo 'source <(kubectl completion bash)' >>~/.bashrc

Setup and alias for kubectl and enable completion for it:

echo 'alias k=kubectl' >>~/.bashrc

echo 'complete -F __start_kubectl k' >>~/.bashrc
© TruongIdeas & Feedback