Skip to content

Instantly share code, notes, and snippets.

@CalvinHartwell
Last active June 27, 2018 22:13
Show Gist options
  • Select an option

  • Save CalvinHartwell/d95e5add959ce40b713ef6c0f9ce2a3c to your computer and use it in GitHub Desktop.

Select an option

Save CalvinHartwell/d95e5add959ce40b713ef6c0f9ce2a3c to your computer and use it in GitHub Desktop.
Canonical Kubernetes Rancher 2.0 with RBAC, CANAL and Ingress Rule
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cluster-admin
subjects:
- kind: ServiceAccount
name: default
namespace: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: cluster-admin
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: rancher
name: rancher
spec:
replicas: 1
selector:
matchLabels:
app: rancher
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: rancher
spec:
containers:
- image: rancher/rancher:latest
imagePullPolicy: Always
name: rancher
ports:
- containerPort: 443
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
timeoutSeconds: 30
resources: {}
#args:
# - --debug
restartPolicy: Always
serviceAccountName: ""
status: {}
---
apiVersion: v1
kind: Service
metadata:
name: rancher
labels:
app: rancher
spec:
ports:
- port: 443
targetPort: 443
protocol: TCP
selector:
app: rancher
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: rancher
annotations:
kubernetes.io/tls-acme: "true"
# for updated ingress controller, use this line
nginx.ingress.kubernetes.io/secure-backends: "true"
# for the old ingress controller, use this line
#ingress.kubernetes.io/secure-backends: "true"
spec:
tls:
- hosts:
# replace this with DNS entry pointing to worker nodes.
- rancher.kittens.com
rules:
# replace this with DNS entry pointing to worker nodes.
- host: rancher.kittens.com
http:
paths:
- path: /
backend:
serviceName: rancher
servicePort: 443
---
# The nodeport is optional if you are using ingress rule.
apiVersion: v1
kind: Service
metadata:
name: rancher-nodeport
spec:
type: NodePort
selector:
app: rancher
ports:
- name: rancher-nodeport
protocol: TCP
nodePort: 30443
port: 443
targetPort: 443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment