Skip to content

Instantly share code, notes, and snippets.

View mattsdni's full-sized avatar
:shipit:

Matt Dennie mattsdni

:shipit:
View GitHub Profile
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PATH=~/Library/Python/2.7/bin:$PATH
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/dev
source /usr/local/bin/virtualenvwrapper.sh
if [ -f ~/.git-completion.bash ]; then

Helm

Helm allows us to bundle together many Kubernetes resources into Charts

Main Concepts

Charts

A Chart is a Helm package. It contains all of the resource definitions necessary to run an application, tool, or service inside of a Kubernetes cluster. Think of it like the Kubernetes equivalent of a Homebrew formula, an Apt dpkg, or a Yum RPM file.

Repositories

A Repository is the place where charts can be collected and shared. It’s like Perl’s CPAN archive or the Fedora Package Database, but for Kubernetes packages.

infoblox
package main
import (
"fmt"
"net/http"
"io/ioutil"
"os"
)
func main() {
{
"Resources": {
"AWSAutoScalingAutoScalingGroupmasteruseast1amastersmyfirstclusterk8slocal": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AutoScalingGroupName": "master-us-east-1a.masters.myfirstcluster.k8s.local",
"LaunchConfigurationName": {
"Ref": "AWSAutoScalingLaunchConfigurationmasteruseast1amastersmyfirstclusterk8slocal"
},
"MaxSize": 1,
# Wide open access to the cluster (mostly for kubelet)
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: cluster-writer
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
- nonResourceURLs: ["*"]

Kubernetes Bare Metal

This guide shows how to install Kubernetes on a bare metal device.

Initial package installation

sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo touch /etc/apt/sources.list.d/kubernetes.list 
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/matt/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
  1. Install the boto3 library which is the AWS SDK for Python:
pip install boto3
  1. Create an AWS IAM user with MTurk permissions and obtain the access key ID and secret access key. You will need these to authenticate with the MTurk API.
  • Go to the IAM console in your AWS account.
  • Click on "Users" in the sidebar, and then click "Add user".
  • Enter a username for the new IAM user (e.g. "mturk-api-user") and select "Programmatic access" as the access type. Click "Next: Permissions".
  • On the next screen, select "Attach existing policies directly" and search for "AmazonMTurkFullAccess". Check the box next to this policy to select it. This policy provides full access to the MTurk API.
  • Click "Next: Tags" to skip the optional tags screen.
import requests
long_url = '' # TODO put your original link here
# List of custom aliases for each short URL
aliases = ['djkfhsfkljewh', 'we89hidsuhvkshd', 'sdhfewkluhdskvjhsd'] # TODO update your aliases here
api_key = '' # TODO add your api key here
# Create headers with your API key