updating a configmap/secrets in kubernetes

At work, we started using Kubernetes for stateless application. We frequently change the values of configmap/secrets especially in staging environments, however, this is still not baked in to k8s. How to do it? You have to replace a config to update it. For example, if you create a configmap like this: kubectl create configmap site-config --from-file=nginx.conf If you want to update that, you have to add the command above with ...

March 6, 2018 · 1 min · Zakatell Kanda

give more...

I’m currently reading a book called Give and Take, it made me realize the value of sharing on my blog and in everyday life, I hope to write more about things that I can give value to others as well as a constant reminder of things that have given me lots of “Aha” moments in my career as a Software Developer. I really like the quote inside a quote in the book: ...

March 5, 2018 · 1 min · Zakatell Kanda

golang: defer inside a for loop

So I have an infinite for loop however I want to use defer to make my intention clearer. Problem is this defer would never run because my function wouldn’t return. This, in turn, would give you memory leak. As neat as it could be, you can use a closure/anonymous function for this. for x := 0; x < 2; x++ { func() { defer fmt.Println(x) }() } Real world use case: So what I’m trying to do is to have an infinite polling using context on AWS SQS to add a timeout if something is wrong with SQS(this can be anything from network errors to aws being down, it can happen). ...

August 2, 2017 · 1 min · Zakatell Kanda

running elasticsearch on a 2gb digital ocean droplet

So I want to run Elasticsearch on a very limited memory machine and I keep running on this error: cannot allocate memory. Did some research and found this docs on increasing max_map_count: echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf sudo sysctl -w vm.max_map_count=262144 But the problem still persists, turns out memory still actually still not enough. I want don’t to upgrade the memory since I just want to test things out and I have no plan on running it on production. ...

July 3, 2017 · 1 min · Zakatell Kanda

gophercon sg 2017 reflection

This is the first time attending a conference outside my country. It was pretty exciting and scary because I’m going alone but nonetheless it was an amazing experience. I met a couple of interesting people and mostly I think it boosts more my confidence in traveling. The first day was all about learning Go for Intermediate developers by William Kennedy. I learned quite a lot, although I’ve been using Go in work for some time now, I admit that I still have a long way to go. The core that I have to learn more is how to effectively use interface. I was awed when he showed the tooling on profiling a Go code, I’m looking forward on his blog post diving deeper on these subject. ...

May 27, 2017 · 3 min · Zakatell Kanda

golang impression

I’ve been very excited to use Go at work and somehow very refreshing, been meaning to learn it for some time but it’s easier for me to learn if I actually see it in action. So far it’s been very nice, though of course, some stuff is not so easy. Here’s one trivial matter. First using it with Python feel like I’m lost when context switching. Our main application is written in Python/Django and we are slowly trying to build microservices around it. They communicate via thrift. I had to test a package that makes sure it truncates to a certain Unicode character limit. This is when I appreciated Python for having duck typing. I can just build a long character like this: ...

May 20, 2017 · 2 min · Zakatell Kanda

aws rds postgres - error: must be member of role

I recently had to add a user for postgres in AWS RDS but it’s giving me this error: ERROR: must be member of role "test" So here’s what I did: First, create a user with CREATEDB capability: CREATE USER testuser WITH CREATEDB PASSWORD 'testpassword'; \q Connect again with this new user and create the database: CREATE DATABASE testdb OWNER testuser; That’s it.

March 31, 2017 · 1 min · Zakatell Kanda

upgraded windows on my dual boot laptop causes problems on bootloader.

So I upgraded my Windows partition to latest insider preview and it kind of messed up my laptop. Here’s the error message: EFI stub: ERROR: failed to read file. Trying to load files to higher address EFI stub: ERROR: failed to read file. Here’s the step I did to resolved it. Boot in an ArchLinux liveusb. Mount your root and boot partition. Chroot into it. And reinstall the bootloader. mkinitcpio -p linux bootctl install Reboot and it should be good now. ...

January 30, 2017 · 1 min · Zakatell Kanda

installing python packages directly from github using pip

Recently, I needed to install a package directly from Github which I’m trying to contribute into. For example, you have this url: https://github.com/zkanda/lambda-uploader What you can do is just add git+ as a prefix in the URL. Here’s how you can do it! pip install git+https://github.com/zkanda/lambda-uploader But I want to install a code in another branch, so how do we do it? We just add @branch_name at the end of the url. ...

December 5, 2016 · 1 min · Zakatell Kanda

setting a different vimrc and runtime for vim

Today, I decided to update my script and search for a way to easily change how I can load vimrc and .vim/ directory. And vim provides a very convenient way to do it using the environment variable. VIMINIT - for switching vimrc. VIMRUNTIME - for the .vim directory. You can use it like this: VIMINIT=/path/to/custom/vimrc vim and VIMRUNTIME=/path/to/.vim vim You can combine them both as well. Click here for the relevant docs ...

November 29, 2016 · 1 min · Zakatell Kanda