Skip to content

Instantly share code, notes, and snippets.

@xetys
Created January 30, 2018 00:05
Show Gist options
  • Save xetys/4c0b7de36846fbdc442c769c18ea22f0 to your computer and use it in GitHub Desktop.
Save xetys/4c0b7de36846fbdc442c769c18ea22f0 to your computer and use it in GitHub Desktop.
hetzner-kube-demo
#!/bin/bash
# install openebs
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-operator.yaml
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-storageclasses.yaml
# install helm
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
echo "apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
" | kubectl apply -f -
# install demo
echo "apiVersion: v1
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: nginx
spec:
storageClassName: openebs-standalone
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100m
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 2
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: html
mountPath: /usr/share/nginx/html
volumes:
- name: html
persistentVolumeClaim:
claimName: nginx
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
ports:
- port: 80
selector:
app: nginx
type: NodePort
" | kubectl apply -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment