Skip to content

Instantly share code, notes, and snippets.

@jpweber
jpweber / storageclass.yaml
Created June 20, 2018 16:55
k8s storage class example
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: general
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
encrypted: "false"
zones: us-east-1a, us-east-1b, us-east-1c
@jpweber
jpweber / pvc.yaml
Last active June 20, 2018 16:56
k8s volume claim example
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: general
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
encrypted: "false"
zones: us-east-2a #, us-east-2b, us-east-2c #add more AZs as appropriate
@jpweber
jpweber / good-k8s-manifest.md
Created April 24, 2018 21:06
What makes a good K8s manifest

What makes a good K8s manifest

Aside from the required parts, the following is a list of fields that should be included in any deployment manifest. Followed by a layout of a deployment file

MetaData

  • name - Make your name something that is easy to Identify what it is. you don’t need to include version information here as that will be elsewhere

  • namespace - Specify a namespace, think of this as the default location you plan to deploy something to. This can always be overridden with kubectl -n <namespace> at a later time.

package main
import (
"bytes"
"io/ioutil"
)
func main() {
files, _ := ioutil.ReadDir(".")
@jpweber
jpweber / Example manifest template
Created February 22, 2018 15:55
Example of how you could template a manifest file and what values you would make variable
## template with a lot of options
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Values.name}}
namespace: {{.Values.environ}}
spec:
replicas: {{.Values.replicas}}
@jpweber
jpweber / heapster deploy
Created February 7, 2018 18:27
example heapster deployment manifest
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: heapster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:heapster
subjects:
- kind: ServiceAccount
@jpweber
jpweber / main.go
Created January 5, 2018 16:53
thing for MIke
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
resource "aws_elb" "kube_api" {
name = "terraform-elb"
subnets = ["${aws_subnet.public.0.id}"]
security_groups = ["${aws_security_group.elb.id}"]
instances = ["${aws_instance.control_plane.id}"]
cross_zone_load_balancing = true
idle_timeout = 400
connection_draining = true
connection_draining_timeout = 400
@jpweber
jpweber / resource-test.yaml
Last active November 16, 2017 05:05
kubernetes manifest for creating pod(s) with resource limits to test limits and autoscaling
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: resourcetest
spec:
replicas: 1
template:
metadata:
labels:
@jpweber
jpweber / fish_right_prompt.fish
Created October 30, 2017 18:50
right side fish prompt with kubctl context name
function fish_right_prompt
set -l k8s_color (set_color purple)
set -l k8s_context (kubectl config current-context)
echo -e -n -s $k8s_color "[$k8s_context]"
end