kubernetes on davidchua https://dchua.com/tags/kubernetes/ Recent content in kubernetes on davidchua Hugo -- gohugo.io en-us Fri, 21 Apr 2017 00:00:00 +0000 Load env variables from ConfigMaps and Secrets upon Pod boot https://dchua.com/posts/2017-04-21-load-env-variables-from-configmaps-and-secrets-upon-pod-boot/ Fri, 21 Apr 2017 00:00:00 +0000 https://dchua.com/posts/2017-04-21-load-env-variables-from-configmaps-and-secrets-upon-pod-boot/ One of the coolest stuff I’ve picked up just today is that you can keep environment variables that you want to be loaded into every deployment pod in a neatly configured ConfigMap or Secret which gets injected back into the Pod during deploys. Lets say you have a Secret that looks like: apiVersion: v1 kind: Secret metadata: name: mysecret type: Opaque data: username: YWRtaW4= password: MWYyZDFlMmU2N2Rm And you want username and password to be easily accessible in ENV['username'] and ENV['password'] on your application pods, all you need is a envFrom within your TemplateSpec Fixing OmniAuth Redirecting to a URI with Port https://dchua.com/posts/2017-01-16-fixing-omniauth-redirecting-to-a-uri-with-port/ Mon, 16 Jan 2017 00:00:00 +0000 https://dchua.com/posts/2017-01-16-fixing-omniauth-redirecting-to-a-uri-with-port/ Came across this problem the other day when deploying a Rails application that is sitting behind Kubernetes and Deis With my Rails application using OmniAuth and its Facebook strategy, after a user logins, hits Facebook and returns a redirection, the URL returned has its port 80 embedded in the return URI like: https://domain.com:80. In most cases, this wouldn’t be a problem but Facebook would return an error as the return URI (with the port 80) is not whitelisted hence creating a bad flow for your user. Using Kubectl proxy to access your Kubernetes services https://dchua.com/posts/2016-11-20-using-kubectl-proxy-to-access-your-kubernetes-services/ Sun, 20 Nov 2016 00:00:00 +0000 https://dchua.com/posts/2016-11-20-using-kubectl-proxy-to-access-your-kubernetes-services/ Sometimes it might be quite difficult to access your kubernetes services if your infrastructure isn’t able to properly support both LoadBalancer and NodePort service types. Or maybe you just want to quickly access your services securely without having it be exposed to the public internet. kubectl proxy is a great tool for you to do just that. First, run kubectl proxy on your local machine. This exposes and proxies port 8081 to your Kubernetes Master. Running Deis on Digitalocean - A Nginx/Haproxy LB Setup https://dchua.com/posts/2016-10-25-running-deis-on-digitalocean/ Tue, 25 Oct 2016 00:00:00 +0000 https://dchua.com/posts/2016-10-25-running-deis-on-digitalocean/ DigitalOcean users generally tend to get the short end of the stick when it comes to convenience. When building your Deis cluster on DigitalOcean, you’ll realize you don’t get the benefit of being able to provision cloud-provider specific load balancers like (AWS ELB, GCE Load Balancers) to route inbound traffic into the kubernetes cluster and into your deis-router. In this article, I’ll quickly go through setting up a (nginx + haproxy) load balancer that sits infront of deis. How to get Kubernetes and Deis onto Azure https://dchua.com/posts/2016-10-17-how-to-get-kubernetes-and-deis-onto-azure/ Mon, 17 Oct 2016 00:00:00 +0000 https://dchua.com/posts/2016-10-17-how-to-get-kubernetes-and-deis-onto-azure/ With Kubernetes Anywhere, setting up a Kubernetes cluster on Microsoft’s Azure isn’t as painful as it used to be. Prerequisite Docker is setup gcc is setup kubectl is setup Azure Subscription ID is prepared Kubernetes Prepare your environment Deploy $ git clone https://github.com/kubernetes/kubernetes-anywhere $ cd kubernetes-anywhere Starting the development process $ make docker-dev $ make deploy You’ll be prompted to fill up the required fields. Please skip the following fields by leaving them blank. Building a Kubernetes PetSet Cluster for your MongoDB ReplicaSet https://dchua.com/posts/2016-08-08-building-a-kubernetes-petset-cluster-for-your-mongodb-replicaset/ Mon, 08 Aug 2016 00:00:00 +0000 https://dchua.com/posts/2016-08-08-building-a-kubernetes-petset-cluster-for-your-mongodb-replicaset/ Some observations when working with Kubernetes 1.3 introduced PetSets to build MongoDB. Here’s my PetSet YAML: # mypetset.yml apiVersion: v1 kind: Service metadata: annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" name: a-mongo labels: name: a-mongo tier: database type: mongo spec: ports: - port: 27017 name: mongo type: NodePort selector: tier: database name: a-mongo --- apiVersion: apps/v1alpha1 kind: PetSet metadata: name: a-mongo spec: serviceName: "a-mongo" replicas: 3 template: metadata: labels: name: a-mongo tier: database annotations: pod. How to change instance size of an existing Kubernetes Cluster https://dchua.com/posts/2016-07-27-how-to-change-instance-size-of-an-existing-kubernetes-cluster/ Wed, 27 Jul 2016 00:00:00 +0000 https://dchua.com/posts/2016-07-27-how-to-change-instance-size-of-an-existing-kubernetes-cluster/ Just recently, I was trying to reverse my poor decision of starting my Kubernetes Cluster on AWS with a very simple t2.micro nodes. If you’re on AWS, your nodes are probably created via an Auto-scaling group. To change your instance size, you’ll need to: Copy the launch configuration that Kubernetes is probably running. Change the instance size of the launch configuration Update the Kubernetes Auto Scaling Group to use the new launch configuration ?