Skip to content

Instantly share code, notes, and snippets.

@0xAhmed
0xAhmed / keybase.md
Created November 28, 2018 14:37
keybase.md

Keybase proof

I hereby claim:

  • I am 0xahmed on github.
  • I am 0xahmed (https://keybase.io/0xahmed) on keybase.
  • I have a public key ASCgAv4S1HRJua51Yb7TaG9wdrTNJPDzhwK3Moe_8Mc5hwo

To claim this, I am signing this object:

@0xAhmed
0xAhmed / build.sh
Last active November 23, 2017 16:49
Docker: Add multiple tags to an image
docker build -t dockbit/hacher:latest \
-t dockbit/hacher:master .
@0xAhmed
0xAhmed / apply-ingress-canary
Last active October 11, 2017 11:25
Applying a k8s Ingress for a Canary release
$ kubectl --namespace=production apply -f app-ingress-canary.yml
ingress "app-ingress" created
# If the backends report HEALTHY, we can start sending requests for testing the endpoints
$ kubectl --namespace=production describe ing
Name: app-ingress
Namespace: production
Address: 35.190.60.217
Default backend: kubeapp-production-service:80 (10.44.1.10:8080,10.44.1.8:8080,10.44.1.9:8080)
Rules:
@0xAhmed
0xAhmed / app-ingress-canary.yml
Last active October 10, 2017 12:33
Example k8s Ingress for Canary routes
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: app-ingress
spec:
backend:
serviceName: kubeapp-production-service
servicePort: 80
rules:
- host: canary.foo.bar
@0xAhmed
0xAhmed / apply-deployment-service-canary
Last active October 10, 2017 13:05
Applying a k8s Deployment + Service for a Canary release
$ sed -i.bak "s#PROJECT_ID#$PROJECT_ID#" app-canary.yml
$ kubectl --namespace=production apply -f app-canary.yml
deployment "kubeapp-canary" created
service "kubeapp-canary-service" created
@0xAhmed
0xAhmed / apply-ingress-production
Last active October 10, 2017 13:06
Applying a k8s Ingress
$ kubectl --namespace=production apply -f app-ingress-production.yml
ingress "app-ingress" created
$ kubectl --namespace=production describe ingress
Name: app-ingress
Namespace: production
Address: 35.201.88.154
Default backend: kubeapp-production-service:80 (10.44.0.12:8080,10.44.1.9:8080,10.44.2.8:8080)
Rules:
Host Path Backends
@0xAhmed
0xAhmed / app-ingress-production.yml
Created October 4, 2017 22:49
Example k8s Ingress with default backend
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: app-ingress
spec:
backend:
serviceName: kubeapp-production-service
servicePort: 80
@0xAhmed
0xAhmed / get-k8s-services.sh
Last active October 10, 2017 13:06
Check k8s Services
$ kubectl --namespace=production get service
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubeapp-production-service 10.47.253.161 <nodes> 80:30848/TCP 40s
@0xAhmed
0xAhmed / apply-deployment-service
Last active October 10, 2017 13:08
Applying a k8s Deployment + Service
$ sed -i.bak "s#PROJECT_ID#$PROJECT_ID#" app-production.yml
$ kubectl --namespace=production apply -f app-production.yml
deployment "kubeapp-production" created
service "kubeapp-production-service" created
$ kubectl --namespace=production rollout status deployment/kubeapp-production
Waiting for rollout to finish: 0 of 3 updated replicas are available...
Waiting for rollout to finish: 2 of 3 updated replicas are available...
deployment "kubeapp-production" successfully rolled out
@0xAhmed
0xAhmed / app-stable.yml
Created October 4, 2017 14:04
Example k8s Deployment exposing Service for use by Ingress resources
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: kubeapp-production
spec:
replicas: 3
template:
metadata:
name: kubeapp
labels: