mirror of
https://github.com/eliasstepanik/caddy-ingess.git
synced 2026-01-27 11:28:27 +00:00
cleanup folder structure and add setup docs
This commit is contained in:
parent
eea8235435
commit
bd7ec4848d
49
README.md
Normal file
49
README.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Caddy Ingress Controller
|
||||||
|
|
||||||
|
This is the Kubernetes Ingress Controller for Caddy. It includes functionality for monitoring
|
||||||
|
Ingress resources on a Kubernetes cluster and includes support for providing automatic https
|
||||||
|
certificates for all hostnames defined in ingress resources that it is managing.
|
||||||
|
|
||||||
|
## Cloud Provider Setup (AWS, GCLOUD, ETC...)
|
||||||
|
|
||||||
|
In the Kubernetes folder a Helm Chart is provided to make installing the Caddy Ingress Controller
|
||||||
|
on a Kubernetes cluster straight forward. To install the Caddy Ingress Controller adhere to the
|
||||||
|
following steps:
|
||||||
|
|
||||||
|
1. Create a new namespace in your cluster to isolate all Caddy resources.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubectl apply -f ./kubernetes/deploy/00_namespace.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install the Helm Chart. (If you do not want automatic https set `autotls` to false and do not include
|
||||||
|
your email address as a value to the helm chart.)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
helm template \
|
||||||
|
--namespace=caddy-system ./kubernetes/helm/caddyingresscontroller/ \
|
||||||
|
--set autotls=true \
|
||||||
|
--set email=youremail@test.com | kubectl apply -f -
|
||||||
|
```
|
||||||
|
|
||||||
|
The helm chart will create a service of type `LoadBalancer` in the `caddy-system` namespace on your cluster. You'll want to
|
||||||
|
set any DNS records for accessing this cluster to the external IP address of this LoadBalancer when the
|
||||||
|
external IP is provisioned by your cloud provider.
|
||||||
|
|
||||||
|
You can get the external IP address with `kubectl get svc -n caddy-system`
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
To view any logs generated by Caddy or the Ingress Controller you can view the pod logs of the Caddy Ingress Controller.
|
||||||
|
|
||||||
|
Get the pod name with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubectl get pods -n caddy-system
|
||||||
|
```
|
||||||
|
|
||||||
|
View the pod logs:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubectl logs <pod-name> -n caddy-system
|
||||||
|
```
|
||||||
@ -1,24 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: example
|
|
||||||
labels:
|
|
||||||
app: example
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: example
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: example
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: httpecho
|
|
||||||
image: hashicorp/http-echo
|
|
||||||
args:
|
|
||||||
- "-listen=:8080"
|
|
||||||
- "-text=hello world"
|
|
||||||
ports:
|
|
||||||
- containerPort: 8080
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: example2
|
|
||||||
labels:
|
|
||||||
app: example2
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: example2
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: example2
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: httpecho
|
|
||||||
image: hashicorp/http-echo
|
|
||||||
args:
|
|
||||||
- "-listen=:8080"
|
|
||||||
- "-text=hello world 2"
|
|
||||||
ports:
|
|
||||||
- containerPort: 8080
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: example
|
|
||||||
annotations:
|
|
||||||
kubernetes.io/ingress.class: caddy
|
|
||||||
spec:
|
|
||||||
rules:
|
|
||||||
- host: caddy2.kubed.co
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
- path: /hello2
|
|
||||||
backend:
|
|
||||||
serviceName: example2
|
|
||||||
servicePort: 8080
|
|
||||||
- path: /hello
|
|
||||||
backend:
|
|
||||||
serviceName: example
|
|
||||||
servicePort: 8080
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
kind: Service
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
name: example
|
|
||||||
spec:
|
|
||||||
type: ClusterIP
|
|
||||||
selector:
|
|
||||||
app: example
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 8080
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
kind: Service
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
name: example2
|
|
||||||
spec:
|
|
||||||
type: ClusterIP
|
|
||||||
selector:
|
|
||||||
app: example2
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 8080
|
|
||||||
4
kubernetes/deploy/00_namespace.yaml
Normal file
4
kubernetes/deploy/00_namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: caddy-system
|
||||||
@ -1,26 +0,0 @@
|
|||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: ClusterRole
|
|
||||||
metadata:
|
|
||||||
name: caddy-ingress-controller-role
|
|
||||||
namespace: caddy-system
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
- "extensions"
|
|
||||||
resources:
|
|
||||||
- ingresses
|
|
||||||
- ingresses/status
|
|
||||||
- secrets
|
|
||||||
verbs: ["*"]
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- services
|
|
||||||
- pods
|
|
||||||
- nodes
|
|
||||||
- routes
|
|
||||||
- extensions
|
|
||||||
verbs:
|
|
||||||
- list
|
|
||||||
- get
|
|
||||||
- watch
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
kind: ClusterRoleBinding
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
metadata:
|
|
||||||
name: caddy-ingress-controller-role-binding
|
|
||||||
namespace: caddy-system
|
|
||||||
roleRef:
|
|
||||||
kind: ClusterRole
|
|
||||||
name: caddy-ingress-controller-role
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: caddy-ingress-controller
|
|
||||||
namespace: caddy-system
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: caddy-ingress-controller
|
|
||||||
namespace: caddy-system
|
|
||||||
labels:
|
|
||||||
app: caddy-ingress-controller
|
|
||||||
chart: "caddy-ingress-controller-v0.1.0"
|
|
||||||
release: "release-name"
|
|
||||||
heritage: "Tiller"
|
|
||||||
version: v0.1.0
|
|
||||||
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
revisionHistoryLimit: 2
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: caddy-ingress-controller
|
|
||||||
release: "release-name"
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: caddy-ingress-controller
|
|
||||||
chart: "caddy-ingress-controller-v0.1.0"
|
|
||||||
release: "release-name"
|
|
||||||
heritage: "Tiller"
|
|
||||||
version: v0.1.0
|
|
||||||
|
|
||||||
spec:
|
|
||||||
serviceAccountName: caddy-ingress-controller
|
|
||||||
containers:
|
|
||||||
- name: caddy-ingress-controller
|
|
||||||
image: "gcr.io/danny-239313/ingresscontroller"
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
securityContext:
|
|
||||||
allowPrivilegeEscalation: true
|
|
||||||
capabilities:
|
|
||||||
drop:
|
|
||||||
- ALL
|
|
||||||
add:
|
|
||||||
- NET_BIND_SERVICE
|
|
||||||
# www-data -> 33
|
|
||||||
runAsUser: 0
|
|
||||||
runAsGroup: 0
|
|
||||||
ports:
|
|
||||||
- name: http
|
|
||||||
containerPort: 80
|
|
||||||
- name: https
|
|
||||||
containerPort: 443
|
|
||||||
env:
|
|
||||||
- name: POD_NAME
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
fieldPath: metadata.name
|
|
||||||
- name: POD_NAMESPACE
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
fieldPath: metadata.namespace
|
|
||||||
args:
|
|
||||||
- -tls
|
|
||||||
- -email=navdgo@gmail.com
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: caddy-ingress-controller
|
|
||||||
namespace: caddy-system
|
|
||||||
labels:
|
|
||||||
app: caddy-ingress-controller
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- name: http
|
|
||||||
port: 80
|
|
||||||
protocol: TCP
|
|
||||||
targetPort: http
|
|
||||||
- name: https
|
|
||||||
port: 443
|
|
||||||
protocol: TCP
|
|
||||||
targetPort: https
|
|
||||||
selector:
|
|
||||||
app: caddy-ingress-controller
|
|
||||||
type: "LoadBalancer"
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
namespace: caddy-system
|
|
||||||
labels:
|
|
||||||
app: caddy-ingress-controller
|
|
||||||
chart: "caddy-ingress-controller-v0.1.0"
|
|
||||||
release: "release-name"
|
|
||||||
heritage: "Tiller"
|
|
||||||
version: v0.1.0
|
|
||||||
|
|
||||||
name: caddy-ingress-controller
|
|
||||||
Loading…
x
Reference in New Issue
Block a user