Category: Systems Admin

  • Ansible, Packer and Configurations

    I use Ansible as provisioner for Packer, to build AMIs to be used as a base image of our development environment. When Ansible is used by Packer, it’s not quite intuitive whether it’s using the same ansible.cfg when I run ansible-playbook command in a terminal. Here’s how to make sure Ansible in Packer session will…

  • Don’t Panic When Kubernetes Master Failed

    It was business as usual when I was upgrading our Kubernetes cluster from 1.9.8 to 1.9.10, until it isn’t. From AWS console I can see the new instance for the master is running and the old one has been terminated. There’s 1 catch though, the IP yy.yy.yy.yy is not the IP of the new master…

  • Use Python to Check Difference between Directories Recursively

    I needed to track differences between software release packages, so that if anything changed dramatically, eg. some file missing or much smaller than expected, I can then get a notification to review the new potentially flawed package. I found that filecmp.dircmp class in Python is spot on for this job. Here’s my snippet to compare…

  • Upload Limit in Kubernetes Nginx Ingress Controller

    According to https://github.com/nginxinc/kubernetes-ingress/issues/21#issuecomment-408618569, this is how to lift the upload limit in Nginx Ingress Controller for Kubernetes after recent update to the project: apiVersion: extensions/v1beta1 kind: Ingress metadata: name: test-project-ingress namespace: test-project-dev annotations: kubernetes.io/ingress.class: dev nginx.ingress.kubernetes.io/proxy-body-size: 200m spec: rules: – host: test-project.dev.com http: paths: – path: / backend: serviceName: test-project servicePort: 80 And for now…

  • Auto Scaling in Kubernetes 1.9

    I updated my Kubernetes cluster from 1.8 to 1.9 recently, the upgrade process is very smooth, however the auto-scaling part seemed to be failing. Below are some notes on how I troubleshoot this issue. First to ensure I have both kops and kubectl upgraded to 1.9 on my laptop: Install kubectl 1.9: curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.9.10/bin/linux/amd64/kubect…

  • Manage AWS EBS Snapshot Life Cycle with Lambda

    The timing is not so great. The AWS Data Lifecycle Manager has been announced but I can’t wait for its release. So I decided to use AWS Lambda to do some snapshot lifecycle management. First a role for Lambda having full access to snapshots can be created via the console. To create snapshot with Python…

  • Building Dynamic CI Pipeline with BuildKite

    I was inspired by this BuildKite pipeline sample given by the support team: So in the above case, if the first 2 commands succeed, pipeline.deploy.yml will be loaded into the main CI pipeline. This implementation is just brilliant. I’m not sure if jenkinsfile can do dynamic pipeline like this, but at least jenkinsfile won’t look…

  • Playing with Kubernetes Ingress Controller

    It’s very very easy to use Kubernetes(K8s) to provision an external service with AWS ELB, there’s one catch though(at least for now in 2018). AWS ELB is usually used with an auto scaling group and a launch configuration. However with K8s, EC2 instances won’t get spun directly, only pods will, which is call Horizontal Scaling.…