Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devgine/k3s-in-docker
Create you Kubernetes cluster with k3s using docker and Traefik.
https://github.com/devgine/k3s-in-docker
docker external-secrets helm k3s k8s kubectl kubernetes mini-cluster portainer traefik vault
Last synced: 11 days ago
JSON representation
Create you Kubernetes cluster with k3s using docker and Traefik.
- Host: GitHub
- URL: https://github.com/devgine/k3s-in-docker
- Owner: devgine
- License: mit
- Created: 2024-12-05T22:23:57.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-10T20:28:25.000Z (28 days ago)
- Last Synced: 2024-12-10T21:30:20.962Z (28 days ago)
- Topics: docker, external-secrets, helm, k3s, k8s, kubectl, kubernetes, mini-cluster, portainer, traefik, vault
- Language: Makefile
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# k3s cluster
## About
This repository helps you create a kubernetes cluster locally with [k3s](https://docs.k3s.io/) using `Docker` and `traefik`.
Also it contains all useful utils to manage kubernetes cluster like `kubectl`, `helm` and more## Requirements
* git
* docker
* docker compose
* make## How to
### Install traefik
> If you already have an installed traefik you can skip this stepFirst, install traefik stack from this repository https://github.com/devgine/traefik
### Clone the project
```shell
git clone [email protected]:devgine/k3s-in-docker.git
```### Run containers
```shell
make run
```Enjoy ! 🥳
### Traefik dashboard
> https://traefik.k3s.localhost/
## K8S tools
To manage kubernetes resources in the cluster, you can connect to the k8s container and run kubectl or helm commands.
This container contains the necessary tools to manage kubernetes cluster.```shell
make shell
```Below is an example to install nginx. You should run it inside the k8s container.
```shell
kubectl apply -f 00-nginx.yaml
```
Visit http://nginx.k3s.localhost## Ingress nginx controller
By default, traefik is installed as an ingress reverse proxy, if you want to allow ingress nginx follow the following instructions### Connect to k8s container
```shell
make shell
```
### Create namespace
```shell
kubectl create ns ingress-nginx
```
### Add the helm ingress repository
```shell
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
```
### Install nginx ingress controller
```shell
helm install ingress-nginx ingress-nginx/ingress-nginx -n ingress-nginx
```
## Routing
Router >> *.k3s.localhost >> Docker Traefik >> K3S container >> Ingress (traefik OR nginx) >> Service## K3S config directories
| Node | Directory | Description |
|--------|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Server | /output | k3s will generate a kubeconfig.yaml in this directory. |
| Server | /var/lib/rancher/k3s/server/manifests | This directory is where you put all the (yaml) configuration files of the Kubernetes resources. |
| Agent | /var/lib/rancher/k3s/agent/images | this is where you would place an alternative traefik image (saved as a .tar file with'docker save'), if you want to use it, instead of the traefik:v3.1 image. |## Available apps
* [Install Portainer](.manifests/tools/helm/portainer/README.md)
* [Install Vault](.manifests/tools/helm/vault/README.md)## References
https://github.com/its-knowledge-sharing/K3S-Demo/blob/production/docker-compose.yaml
https://docs.k3s.io/cli/server
https://thenets.org/how-to-create-a-k3s-cluster-with-nginx-ingress-controller/
https://blog.stephane-robert.info/post/homelab-ingress-k3s-certificats-self-signed/### Addons
https://github.com/its-knowledge-sharing/K3S-Demo-Addons### Custom coredns
https://github.com/owncloud/docs-ocis/issues/716
https://learn.microsoft.com/en-us/azure/aks/coredns-custom#hosts-plugin## ISSUES
https://github.com/k3s-io/k3s/issues/11165
https://github.com/k3s-io/k3s/issues/11173