Some bits and pieces of useful commands for working with k8s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGEX="^prefix-" | |
| WAIT=true | |
| stacks=$(aws cloudformation describe-stacks --query Stacks[].StackName --output=text) | |
| for stack in $stacks; do | |
| if [[ $stack =~ $REGEX ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| dynamodb = boto3.resource('dynamodb', 'region-name') | |
| table = dynamodb.Table('table-name') | |
| scan = table.scan( | |
| ProjectionExpression='#k', | |
| ExpressionAttributeNames={ | |
| '#k': 'name' | |
| } |
service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval(in minutes)service.beta.kubernetes.io/aws-load-balancer-access-log-enabled(true|false)service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-nameservice.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefixservice.beta.kubernetes.io/aws-load-balancer-additional-resource-tags(comma-separated list of key=value)service.beta.kubernetes.io/aws-load-balancer-backend-protocol(http|https|ssl|tcp)service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled(true|false)
This is a quick recipe for deploying cert-manager and nginx-ingress on GKE to obtain SSL certificates from Lets Encrypt. Whilst this recipe is designed for Google Cloud Platform, it can easily be adapted for other cloud platforms.
We'll begin with a Kubernetes cluster, and we'll obtain authentication credentials.
gcloud container clusters get-credentials my-test-app
kubectl config current-context
kubectl get nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| sudo apt-get update | |
| sudo apt-get install python3 python3-pip postgresql postgresql-contrib nginx virtualenv | |
| mkdir ~/cp3 | |
| cd ~/cp3 | |
| virtualenv --python=python3 venv | |
| git clone https://github.com/code-sleuth/yummy-recipes-api.git yummy-api | |
| cd yummy-api | |
| touch .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version='1.0' encoding='UTF-8'?> | |
| <project> | |
| <actions/> | |
| <description></description> | |
| <keepDependencies>false</keepDependencies> | |
| <properties/> | |
| <scm class="hudson.plugins.git.GitSCM" plugin="git@2.5.2"> | |
| <configVersion>2</configVersion> | |
| <userRemoteConfigs> | |
| <hudson.plugins.git.UserRemoteConfig> |
Link to these links: https://git.io/vKSVZ
Module 1:
- Run jenkins from war file:
jenkins -jar jenkins.war - Run jenkins from docker:
docker run -d \
--restart unless-stopped \
--name jenkins \
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This assumes you have some role that can read some secret at secret/foo. | |
| export VAULT_ADDR="http://my_vault_address.com" | |
| export GCE_ROLE = "my-gce-role" | |
| apt-get update | |
| apt-get install -y jq | |
| # Curl out to metadata server to get token | |
| JWT=$(curl -H "Metadata-Flavor: Google" -G \ |