Skip to content

Instantly share code, notes, and snippets.

@innovia
innovia / lambda-concurrency-to-cloudwatch.py
Created December 17, 2017 09:30
Lambda concurrent execution custom metric on CloudWatch
#!/usr/bin/env python
import boto3
import datetime
import time
ENABLED_REGIONS = [
"us-east-1",
"us-west-2",
"eu-west-1",
"eu-central-1",
@innovia
innovia / vault-kms-ssm.sh
Created January 21, 2018 12:25
encrypt-vault-unseal-keys-kms-ssm
export PREFIX=<your-prefix>-
export KMS_KEY_ID=<kms-key-id>
export ROOT_KEY=<vault-root-token>
export UNSEAL0=<vault-unseal-key-1>
export UNSEAL1=<vault-unseal-key-2>
export UNSEAL2=<vault-unseal-key-3>
export UNSEAL3=<vault-unseal-key-4>
export UNSEAL4=<vault-unseal-key-5>
mkdir -p /tmp/vault
@innovia
innovia / consul-csr.json
Last active March 12, 2019 12:18
hosts section on consul_csr
{
"CN": "server.dc1.cluster.local",
"hosts": [
"server.dc1.cluster.local",
"127.0.0.1",
"consul.default.svc.cluster.local",
"vault.default.svc.cluster.local"
],
"key": {
"algo": "rsa",
@innovia
innovia / values.yaml
Created February 11, 2018 19:10
Vault chart values
# Default values for vault.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 3
image:
repository: vault
tag: 0.9.3
pullPolicy: IfNotPresent
service:
name: vault
@innovia
innovia / update_tags.sh
Created March 27, 2018 06:53
Update force existing tags
Delete the tag on any remote before you push
git push origin :refs/tags/<tagname>
Replace the tag to reference the most recent commit
git tag -fa <tagname>
Push the tag to the remote origin
git push origin master --tags
@innovia
innovia / nvidia.sh
Last active May 16, 2020 14:59
download nvidia drivers and CUDA libs
# This script is built on kops bootstrap
# https://github.com/dcwangmit01/kops/blob/ef958a7f870eb3dc20981617859b8ad69057bb2a/hooks/nvidia-bootstrap/image/run.sh
mkdir nvidia
cd nvidia
# Get the NVIDIA driver
wget http://us.download.nvidia.com/tesla/390.46/NVIDIA-Linux-x86_64-390.46.run
chmod a+x NVIDIA-Linux-x86_64-390.46.run
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
sudo tee /etc/apt/sources.list.d/nvidia-docker.list
apt-get update && sudo apt-get install -y \
apt-transport-https \
ca-certificates \
apiVersion: v1
kind: Pod
metadata:
name: gpu-pod
spec:
containers:
- name: cuda-container
image: nvidia/cuda:9.0-devel
resources:
limits:
apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
labels:
name: p3.2xlarge
spec:
image: My-k8s-1.9-debian-stretch-2018-05-03
kubelet:
featureGates:
DevicePlugins: "true"
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: nvidia-device-plugin-daemonset
namespace: kube-system
spec:
template:
metadata:
# Mark this pod as a critical add-on; when enabled, the critical add-on scheduler
# reserves resources for critical add-on pods so that they can be rescheduled after