Browsed by
Month: August 2019

Ports in Kubernetes Services (Kubernetes)

Ports in Kubernetes Services (Kubernetes)

Just a quick reminder how ports definition in k8s services works. Service definition example below, just forgot all but port definition and take a closer look. NodePort

We can see port definition 3 times (it’s array and you can use as many of them as open ports you need): port, targetPort and nodePort. Why 3 ports? If you are familiar with Docker (Swarm) you would expect only 2, right…? NodePort port : other pod/service inside our cluster can access…

Read More Read More

Port forward to access applications in cluster (Kubernetes)

Port forward to access applications in cluster (Kubernetes)

PROBLEM: Cannot access pods in my k8s deployment for testing SOLUTION: Use very simple port-forward method Find your destination Decide what do you want to access. Port forward works on services, pods, deployments or even replicaSets. The syntax is very simple.

Which leads to example like this:

You can see your app through port 1000 on your local machine (working on the port 3000 on remote). Bear in mind, you are connecting directly to the service/pod/whatever, so use the…

Read More Read More

Create permanent command alias (Linux)

Create permanent command alias (Linux)

PROBLEM: My set up aliases are not persistent after reboot SOLUTION: Write them to ~/.bashrc Edit ~/.bashrc Using sudo

Add as many aliases as you wish! Separe by new line. I prefer adding them on the beginning of the file so I can find them quickly.

Copy output from terminal directly to your clipboard! (Linux)

Copy output from terminal directly to your clipboard! (Linux)

PROBLEM: It is difficult to copy and past outputs from and to terminal SOLUTION: Use xclip! Install xclip To install xclip on Ubuntu just use apt get, on other use the equivalent command.

Basic commands To copy output to your clipboard, just simply use | xclip (| means, everything before pipe is input for command after pipe)like this:

And you have content of myfile in your clipboard! To paste from your clipboard, just use:

Advanced strategy! To work…

Read More Read More

Using Git with Gitlab and second factor auth

Using Git with Gitlab and second factor auth

PROBLEM: After 2nd factor activation on Gitlab, username and password auth is not working anymore SOLUTION: Generate API key and use modified url Generate your API key on Gitlab You can find this option in Preferences > Access Tokens Copy this token and note you will see it only once (you have to generate a new one if the old is lost) Create new URL

So if you would like to push or clone the repo using e.g. git…

Read More Read More

Working with Git on the command line (Linux)

Working with Git on the command line (Linux)

Git basics Simple instruction how to handle git on the command line Check if Git is installed and ready

If not, you can install git using (on Ubuntu)

Set username and email Every commit is marked with username and email to identify the autor

You can check the informations using

(1) Initialize a local directory for Git If you want to include your local directory to version control, use init to tell Git what to track…

Read More Read More