You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can follow [Self-Hosting Your Homelab Services with SSL](https://www.youtube.com/watch?v=pAM2GBCDGTo) to get the idea of Metal LB. It's recommended to:
75
+
76
+
* Install with [helm](https://metallb.universe.tf/installation/#installation-with-helm)
77
+
* Use [Layer2 configuration](https://metallb.universe.tf/configuration/#layer-2-configuration) if you follow this series
74
78
75
79
## Exposing Rancher directly to your Metal LB
76
80
77
-
It's a good idea to do this until traefik is configured otherwise you won't have access to the Rancher Ui
81
+
It's a good idea to do this until traefik is configured otherwise you won't have access to the Rancher UI
Then, you can access Rancher UI after getting external-IP
88
+
89
+
```bash
90
+
kubectl get service/rancher-lb -n cattle-system
91
+
```
92
+
83
93
## Install Traefik 2
84
94
85
95
You can can choose between creating `Ingress` in Rancher or `IngresRoute` with `traefik`
@@ -91,116 +101,130 @@ If you choose `IngressRoute` see [IngressRoute](#exposing-a-service-with-traefik
91
101
* This will get wildcard certs
92
102
* This is pointed at staging, if you want production be sure comment staging the line (and delete your staging certs)
93
103
94
-
We will be installing this into the `kube-system` namespace, which already exists. If you are going to use anther namespace you will need change it everywhere.
104
+
We will be installing this into the `kube-system` namespace, which already exists. If you are going to use anther namespace you will need change it everywhere.
95
105
96
-
add `traefik` helm repo and update
106
+
### (Opional) Make sure that persistent volume claim is available
The dynamic configuration for Traefik is stored in a persistent volume. If you want to persist the certificate, it's better to create one now to claim later.
102
109
103
-
create `traefik-config.yaml` with the contents of `/config/traefik-config.yaml` from [/config](https://github.com/techno-tim/techno-tim.github.io/tree/master/reference_files/traefik2-k3s-rancher/config)
110
+
To create a persistent volume, it's better to check out [Cloud Native Distributed Storage in Kubernetes with Longhorn](https://www.youtube.com/watch?v=eKBBHc0t7bc).
104
111
105
-
this holds our cloudflare secrets along with a configmap
112
+
If not, just create one from `Rancher UI > Clusters (Choose your cluster) > Storage > Persistent Volume > Add volume`
create `traefik-chart-values.yaml` with the contents of `/config/traefik-chart-values.yaml` from [/config](https://github.com/techno-tim/techno-tim.github.io/tree/master/reference_files/traefik2-k3s-rancher/config)
116
-
117
-
Update `loadBalancerIP` in `traefik-chart-values.yaml` with your Metal LB IP
118
-
119
-
120
-
Before running this, be sure you only have one default storage class set. If you are using Rancher it is Cluster>Storage>Storage Classes. Make sure only one is default.
121
-
121
+
### Edit & apply ConfigMap
122
122
123
-
create config then update the values
123
+
* Create `traefik-config.yaml` with the contents of `/config/traefik-config.yaml` from [/config](https://github.com/techno-tim/techno-tim.github.io/tree/master/reference_files/traefik2-k3s-rancher/config)
124
+
* This holds our cloudflare secrets along with a configmap
125
+
* Update this file with your values
126
+
* Re-check if you have a persistent volume ready to claim
If all went well, you should now have traefik 2 installed and configured.
133
+
### Edit & install Traefik helm chart
134
134
135
+
* Create `traefik-chart-values.yaml` with the contents of `/config/traefik-chart-values.yaml` from [/config](https://github.com/techno-tim/techno-tim.github.io/tree/master/reference_files/traefik2-k3s-rancher/config)
136
+
* Update `loadBalancerIP` in `traefik-chart-values.yaml` with your Metal LB IP
135
137
136
-
## Exposing a service with traefik and Rancher Ingress
138
+
Before running this, be sure you only have one default storage class set.
137
139
138
-
In Rancher go to Load Balancing
140
+
If you are using Rancher it is `Cluster > Storage > Storage Classes`. Make sure only one is default.
139
141
140
-
* create ingress
141
-
* choose a host name (service.example.com)
142
-
* choose a target (your workload)
143
-
* set the port to the exposed port within the container
144
-
* go to labels and annotations and add `kubernetes.io/ingress.class` = `traefik-external`
145
-
* note, `traefik-external` comes from `--providers.kubernetesingress.ingressclass=traefik-external` in `traefik-chart-values.yml`. If you used something else, you will need to set your label properly.
146
-
* when you visit your website (`https://service.example.com`) you should now see a certificate issues. If it's a staging cert, see the note about switching to production in `traefik-chart-values.yaml`. After changing, you will need to delete your certs in storage and reapply that file
More configuration value can be add from this [default-value.yaml](https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml) from Traefik github.
154
149
155
-
copy the contents of [config-ingress-route/kubernetes](https://github.com/techno-tim/techno-tim.github.io/tree/master/reference_files/traefik2-k3s-rancher/config-ingress-route) to your local machine
150
+
If all went well, you should now have traefik 2 installed and configured.
156
151
157
-
then run
152
+
### Check for container logs
153
+
154
+
To check if the Traefik instance is running correctly, see the logs:
copy `traefik-dashboard-ingressroute.yaml` and update it with your hostname
196
+
This should create:
197
+
* A secret in Kubernetes cluster name `traefik-dashboard-auth`
198
+
* A middleware for Traefik name `traefik-dashboard-basicauth`
199
+
* An ingress route for Traefik name `dashboard`
197
200
201
+
Check out the Traefik Dashboard with the URL you specify earlier.
198
202
199
-
Save this in a secure place, it will be the password you use to access the traefik dashboard
203
+
## Exposing a service with traefik and Rancher Ingress
200
204
205
+
In Rancher go to Load Balancing
201
206
202
-
## files
207
+
* create ingress
208
+
* choose a host name (service.example.com)
209
+
* choose a target (your workload)
210
+
* set the port to the exposed port within the container
211
+
* go to labels and annotations and add `kubernetes.io/ingress.class` = `traefik-external`
212
+
* note, `traefik-external` comes from `--providers.kubernetesingress.ingressclass=traefik-external` in `traefik-chart-values.yml`. If you used something else, you will need to set your label properly.
213
+
* when you visit your website (`https://service.example.com`) you should now see a certificate issues. If it's a staging cert, see the note about switching to production in `traefik-chart-values.yaml`. After changing, you will need to delete your certs in storage and reapply that file
copy the contents of [config-ingress-route/kubernetes](https://github.com/techno-tim/techno-tim.github.io/tree/master/reference_files/traefik2-k3s-rancher/config-ingress-route) to your local machine
223
+
224
+
then run
225
+
226
+
```bash
227
+
kubectl apply -f kubernetes
228
+
```
205
229
206
-
TBD
230
+
This will create the deployment, service, and ingress.
0 commit comments