-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72497a9
commit 7783e1b
Showing
57 changed files
with
845 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
# Whanos | ||
# Whanos 🦄 | ||
Don't let your applications be snapped by Thanos 🫰 | ||
## Introduction | ||
### What is Whanos? | ||
Whanos is a tool that allows you to easily Dockerize your applications and deploy them to a Kubernetes cluster. It uses a Jenkins instance to build and push the Docker images to a private Docker registry and a Helm chart to deploy the applications to the Kubernetes cluster. | ||
|
||
Epitech project - Whanos | ||
### Goals | ||
- Easily deploy applications to a Kubernetes cluster | ||
- Easily build and push Docker images to a private Docker registry | ||
|
||
## Documentation | ||
You can find documentation under the [docs](docs) directory. | ||
The mail goal of Whanos is for a developer to focus on the application code and not on the infrastructure. | ||
|
||
By simply starting a Jenkins job, the developer will be able to Dockerize his application. | ||
|
||
If the developer want to deploy the application to the Kubernetes cluster, he will simply have to add a file called `whanos.yaml` to the root of his project and start a Jenkins job. Whanos will take care of building the Docker image, pushing it to the private Docker registry and deploying the application to the Kubernetes cluster. | ||
|
||
## Table of contents | ||
- [Introduction](#introduction) | ||
- [What is Whanos?](#what-is-whanos) | ||
- [Goals](#goals) | ||
- [Installation](#installation) | ||
- [Using ansible](#using-ansible) | ||
- [How it works](#how-it-works) | ||
- [What ansible does on the machines](#what-ansible-does-on-the-machines) | ||
- [Install prerequisites](#install-prerequisites) | ||
- [Deploy the cluster](#deploy-the-cluster) | ||
- [Install docker registry](#install-docker-registry) | ||
- [Usage](#usage) | ||
|
||
## Authors | ||
* [Gwenaël HUBLER](https://github.com/Neeptossss) | ||
- [**Gwenaël HUBLER**](https://github.com/Neeptossss) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# How it works ? | ||
In this section we will break down the different steps that are involved in the installation and usage of Whanos. | ||
|
||
## What ansible does on the machines ? | ||
### Install prerequisites | ||
|
||
### Deploy the cluster | ||
|
||
### Install docker registry | ||
To deploy the docker registry, we will use official templates for the docker-registry and the ingress-nginx controller. We will also use official cert-manager helm chart to generate a self-signed certificate for the registry. | ||
|
||
**Install Nginx ingress controller** | ||
```shell | ||
kubectl apply -f kube/init/nginx-ingress-controller/deployment.yaml | ||
``` | ||
|
||
- **Wait for the ingress controller to be ready** | ||
```shell | ||
kubectl wait --namespace ingress-nginx \ | ||
--for=condition=ready pod \ | ||
--selector=app.kubernetes.io/component=controller \ | ||
--timeout=120s | ||
``` | ||
|
||
- **Install cert-manager using Helm** | ||
```shell | ||
helm repo add jetstack https://charts.jetstack.io | ||
helm repo update | ||
helm install \ | ||
cert-manager jetstack/cert-manager \ | ||
--namespace cert-manager \ | ||
--create-namespace \ | ||
--version v1.5.4 \ | ||
--set installCRDs=true \ | ||
--set ingressShim.defaultIssuerName=letsencrypt-prod \ | ||
--set ingressShim.defaultIssuerKind=ClusterIssuer \ | ||
--set ingressShim.defaultIssuerGroup=cert-manager.io | ||
``` | ||
|
||
- **Wait for the cert-manager to be ready** | ||
```shell | ||
kubectl wait --namespace cert-manager \ | ||
--for=condition=ready pod \ | ||
--selector=app.kubernetes.io/component=webhook \ | ||
--timeout=120s | ||
``` | ||
|
||
- **Create the ClusterIssuer for self-signed certificates** | ||
```shell | ||
kubectl apply -f kube/init/cert-manager/cluster-issuer.yaml | ||
``` | ||
|
||
- **Deploy the docker registry** | ||
```shell | ||
kubectl apply -f kube/init/docker-registry/deployment.yaml | ||
kubectl apply -f kube/init/docker-registry/ingress.yaml | ||
``` | ||
|
||
- **Wait for the docker registry ingress to have an external IP and add it to /etc/hosts** | ||
```shell | ||
sudo sh -c 'external_ip=""; while [ -z $external_ip ]; do echo "Waiting for end point..."; external_ip=$(kubectl get ingress -n docker-registry docker-registry -o jsonpath="{.status.loadBalancer.ingress[0].ip}"); [ -z "$external_ip" ] && sleep 10; done; echo "End point ready" && echo $external_ip whanos-registry.local >> /etc/hosts' | ||
``` | ||
|
||
- **Add the self-signed certificate to docker client truster certificates** | ||
```shell | ||
sudo mkdir -p /etc/docker/certs.d/whanos-registry.local:443/ | ||
kubectl get secret registry-tls -n docker-registry -o jsonpath='{.data.ca\.crt}' | base64 --decode > /etc/docker/certs.d/whanos-registry.local:443/ca.crt | ||
``` | ||
|
||
### Install jenkins |
File renamed without changes.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
dependencies: | ||
- name: jenkins | ||
repository: https://charts.jenkins.io | ||
version: 4.8.3 | ||
- name: docker-registry | ||
repository: https://helm.twun.io | ||
version: 2.2.2 | ||
- name: nginx-ingress | ||
repository: https://helm.nginx.com/stable | ||
version: 1.0.2 | ||
digest: sha256:e2833a772c4622b364121c3e2d2d3f0aafeccbba7766d6e7891fcd56fa9667e3 | ||
generated: "2023-11-30T12:56:46.739367+01:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: cert-manager.io/v1 | ||
kind: ClusterIssuer | ||
metadata: | ||
name: selfsigned-issuer | ||
spec: | ||
selfSigned: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: docker-registry | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: docker-registry | ||
namespace: docker-registry | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: docker-registry | ||
template: | ||
metadata: | ||
labels: | ||
app: docker-registry | ||
spec: | ||
containers: | ||
- name: docker-registry | ||
image: registry:2.6.2 | ||
env: | ||
- name: REGISTRY_HTTP_ADDR | ||
value: ":5000" | ||
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY | ||
value: "/var/lib/registry" | ||
ports: | ||
- name: http | ||
containerPort: 5000 | ||
volumeMounts: | ||
- name: image-store | ||
mountPath: "/var/lib/registry" | ||
volumes: | ||
- name: image-store | ||
emptyDir: {} | ||
|
||
--- | ||
|
||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: docker-registry | ||
namespace: docker-registry | ||
labels: | ||
app: docker-registry | ||
spec: | ||
selector: | ||
app: docker-registry | ||
ports: | ||
- name: http | ||
port: 5000 | ||
targetPort: 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
cert-manager.io/cluster-issuer: selfsigned-issuer | ||
name: docker-registry | ||
namespace: docker-registry | ||
spec: | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- whanos-registry.local | ||
secretName: registry-tls | ||
rules: | ||
- host: whanos-registry.local | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: docker-registry | ||
port: | ||
number: 5000 |
Oops, something went wrong.