Skip to content
View gist:d10a17e51ca808ca82733f8f307de297
function kubernetes::deployment::wait {
deployment=$1
ns=${2:-'default'};
k_cmd="kubectl --namespace=$ns get deployments $deployment";
while true; do
observed=$($k_cmd -o 'jsonpath={.status.observedGeneration}');
generated=$($k_cmd -o 'jsonpath={.metadata.Generation}');
[ "$?" -ne 0 ] && break;
[ "${observed}" -ge "${generated}" ] && {
updated_replicas=$($k_cmd -o 'jsonpath={.status.updatedReplicas}');
View ingress-pod
$ kubectl exec --tty -i nginx-ingress-controller-9xccu -- ls -alh --color
total 6.2M
drwxr-xr-x 46 root root 4.0K May 1 12:47 .
drwxr-xr-x 46 root root 4.0K May 1 12:47 ..
-rwxr-xr-x 1 root root 0 May 1 12:46 .dockerenv
-rwxr-xr-x 1 root root 0 May 1 12:46 .dockerinit
drwxr-xr-x 2 root root 4.0K Apr 28 00:50 bin
drwxr-xr-x 2 root root 4.0K Nov 27 13:59 boot
drwxr-xr-x 5 root root 380 May 1 12:46 dev
drwxr-xr-x 45 root root 4.0K May 1 12:46 etc
View example.py
import boto3
r53_client = boto3.client('route53')
hosted_zone = 'alias.photobox.com.'
def lambda_handler(event = {}, context = {}):
aws_region = event['detail']['awsRegion']
elb_client = boto3.client('elb', region_name=aws_region)
View bootstrap.sh
export KUBE_AWS_ZONE=eu-west-1c
export NUM_NODES=4
export MASTER_SIZE=m3.xlarge
export NODE_SIZE=m3.medium
export AWS_S3_REGION=eu-west-1
export AWS_S3_BUCKET=photobox-kubernetes-artifacts
export INSTANCE_PREFIX=k8s
export KUBERNETES_PROVIDER=aws;
export MULTIZONE=1;
export AWS_SSH_KEY=~/.ssh/photobox-eu
View index.js
'use strict';
console.log('Loading event');
var logGroupName = 'vpc-flow-logs',
region = 'eu-west-1';
var AWS = require('aws-sdk'),
Promise = require('bluebird'),
async = require('async'),
View gist:328055f3713eeeb2eb32
andrew@andrew-office:~/Desktop/projects/github/photobox/services-operations/aws/sparkleformation/cloudformation$ export KUBERNETES_PROVIDER=aws; wget -q -O - https://get.k8s.io | bash
Downloading kubernetes release v1.1.2 to /home/andrew/Desktop/projects/github/photobox/services-operations/aws/sparkleformation/cloudformation/kubernetes.tar.gz
--2015-12-01 15:40:33-- https://storage.googleapis.com/kubernetes-release/release/v1.1.2/kubernetes.tar.gz
Resolving storage.googleapis.com (storage.googleapis.com)... 64.233.184.128, 2a00:1450:400c:c0b::80
Connecting to storage.googleapis.com (storage.googleapis.com)|64.233.184.128|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 191474443 (183M) [application/x-tar]
Saving to: ‘kubernetes.tar.gz’
100%[======================================================================================================================================================================================================================================================
View create-elbs.sh
ELBS="`aws elb describe-load-balancers`";
echo "$ELBS" | jq -c '.LoadBalancerDescriptions[] | select(.LoadBalancerName|contains("production-services"))' | tr -d '^J' | while read line; do
NAME=$(echo $line | jq -r '.LoadBalancerName')
echo $NAME | grep tmp$ && continue;
LISTENERS=$(echo $line | jq -c '.ListenerDescriptions[].Listener'| tr -d '^J' | tr '\n' ',' | sed 's/^/\[/g;s/,$/]/g');
SCHEME=$(echo $line | jq -r '.Scheme')
aws elb create-load-balancer --load-balancer-name "${NAME}tmp" --listeners "${LISTENERS}" --scheme "${SCHEME}" --security-groups sg-3c7df658 --subnets subnet-f598ee9d
done;
View docker
9e38d6183e86 docker.photobox.com:443/photobox/services-shipping:v_182 "bash /run.sh" 32 hours ago Up 32 hours 8080-8081/tcp, 0.0.0.0:8096->8096/tcp ecs-production-services-shipping-15-production-services-shipping-9ca3c0e2b792879ce601
View event.json
{
"Records": [
{
"awsRegion": "eu-west-1",
"eventID": "0ed50878-9f42-4e73-a361-2d19ee0a61d7",
"eventName": "LookupEvents",
"eventSource": "cloudtrail.amazonaws.com",
"eventTime": "2015-11-22T12:26:22Z",
"eventType": "AwsApiCall",
"eventVersion": "1.04",
View gist:6750772a9b22c47c12fc
root@checkout-web1:/home/ubuntu# sar -r -f /var/log/sysstat/sa11
Linux 3.13.0-68-generic (checkout-web1) 11/11/2015 _x86_64_ (2 CPU)
08:04:05 PM LINUX RESTART
08:04:43 PM LINUX RESTART
08:05:01 PM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty
08:15:01 PM 5247780 2927856 35.81 153484 1875052 1603000 19.61 1341056 1276076 264
08:25:01 PM 5197672 2977964 36.42 158040 1887524 1633344 19.98 1388768 1275992 372
Something went wrong with that request. Please try again.