Access etcd in OpenShift origin

Access the etcd in OpenShift started by oc cluster up

Suraj Deshmukh

1 minute read

How do you access the etcd that is being used by the OpenShift started by oc cluster up or using minishift. If you are using minishift then get docker environment access of the minishift VM by running following commands. eval $(minishift docker-env) && eval $(minishift oc-env) Exec into the container named origin that runs OpenShift and all the needed services. $ docker exec -it origin bash First install the etcdctl needed to talk to etcd.

Change namespaces in Kubernetes

Easy way to change namespace in Kubernetes

Suraj Deshmukh

3 minute read

There is no easy way to change namespace in Kubernetes using kubectl command line utility. But here are some commands that you can alias in your bashrc file so that it’s just a single command that you can use to change the namespace in the Kubernetes cluster. Change namespace Let’s see step by step what goes in to change the namespace. So the first step is to find the context.

Prometheus with existing application on OpenShift

Setting up Prometheus with any application

Suraj Deshmukh

2 minute read

This post is very specific to OpenShift and how you can have an application exposing prometheus metrics to be scraped by a prometheus running in the same cluster. Requirements Setting up cluster I have done it using the oc cluster up, read about how to do this here. You could also setup a local OpenShift cluster by running minishift, read about setting up minishift here. Downloading Kedge The configurations defined for setting up this cluster is written in a format that is understood by a tool called Kedge.

Notes on talk - Advanced testing in golang by Mitchell Hashimoto

This talk has really great takeaways which are worth considering while writing your tests

Suraj Deshmukh

1 minute read

Test Fixtures “go test” sets pwd as package directory Test Helpers should never return an error they should access to the *testing.T object call t.Helper() in the beginning (works only for go1.9+) for things reqiuiring clean up return closures Configurability Unconfigurable behavior is often a point of difficulty for tests. e.g. ports, timeouts, paths. Over-parameterize structs to allow tests to fine-tune their behavior It’s ok to make these configs unexported so only tests can set them.

Methods that satisfy interfaces in golang

What receiver type methods satisfy which interface, can be understood here.

Suraj Deshmukh

3 minute read

Pointer receiver For a struct User with a method Work with pointer receiver. type User struct { Name string Period int } func (u *User) Work() { fmt.Println(u.Name, "has worked for", u.Period, "hrs.") } func main() { uval := User{"UserVal", 5} uval.Work() pval := &User{"UserPtr", 6} pval.Work() } See on go playground. output: UserVal has worked for 5 hrs. UserPtr has worked for 6 hrs. If we call this method on value type object uval it works, and obviously it works with pointer type object pval.

vscode Shortcuts

Shortcuts for vscode and some notes

Suraj Deshmukh

3 minute read

This post has shortcuts that are generic and golang specific as well. This post will edited from time to time. Shortcuts Toggle side bar Ctrl + B Project explorer in side bar Ctrl + Shift + E Project wide search in side bar Ctrl + Shift + F Source control in side bar Ctrl + Shift + G Copy entire line Ctrl + C (without any selection)

Using private container registries from minikube

A guide to how would you download image from private container registry in minikube

Suraj Deshmukh

2 minute read

I am doing Kubernetes native development using minikube. And for doing that I had to download a Container image that is available in internally hosted private container registry. On the configuration side of doing that you will need to create Kubernetes Secret of type docker-registry. And now refer that secret you just created in your Pod manifest under pod.spec.imagePullSecrets. For more info follow the tutorial in Kubernetes docs on Pull an Image from a Private Registry.

Static Pods using Kubelet on Fedora

Extension to the Kelsey Hightower's tutorial on 'Standalone Kubelet'

Suraj Deshmukh

2 minute read

I wanted to try out Standalone Kubelet Tutorial of Kelsey Hightower by myself but I could not follow it as it is, because it was firstly on GCE and secondly it uses CoreOS, but since I am very familiar to Fedora I thought of following that tutorial on it. To get a quick setup of a fresh Fedora machine use Vagrant. I have used Vagrantfile available here. This blog is only replacement of section Install the Standalone Kubelet in tutorial.

Sharing Vagrant Box offline

Share Vagrant boxes like you shareed Operating System ISOs

Suraj Deshmukh

2 minute read

If you have some box that was downloaded on your machine from Atlas but now you wanna share it on other machines and you don’t have internet to download it, how do you share it? You will need to export the box from machine that has it downloaded already. So on machine with boxes: $ vagrant box list centos/7 (libvirt, 1610.01) centos/7 (libvirt, 1704.01) fedora/25-cloud-base (libvirt, 20161122) fedora/26-cloud-base (libvirt, 20170705) I wanted to share fedora/26-cloud-base box to another machine.

Add new Maps to Counter Strike

Steps to add new maps to CS

Suraj Deshmukh

1 minute read

If you are playing Counter Strike on Steam on linux you might be wondering how do I install new maps in the game. So here are steps to install maps. All the game maps for Counter Strike - Condition Zero are stored in following path: ~/.local/share/Steam/steamapps/common/Half-Life/czero/maps Format of the map files is .bsp. So download the map files from over internet and then put in this location and now you should be able to see the maps in game.