feat(docker): adding k8s compatible Dockerfile

This commit is contained in:
Philippe Caseiro 2023-06-13 16:19:38 +02:00
parent 124018c2d0
commit eab4ca3ec1
7 changed files with 137 additions and 1 deletions

View File

@ -1,5 +1,55 @@
Symfony Skeletor
# Create a dev cluster with "kind"
1. Start your Kubernetes cluster
```shell
export ENGINE="kind"
```
Setup your "harbor" user:
```
export HARBOR_USER_NAME="<pnom>"
```
Create the cluster
```shell
${ENGINE} create cluster --config misc/k8s/${ENGINE}/${ENGINE}-cluster.yaml
```
2. Check your cluster status
```shell
kubectl get nodes
```
All the nodes are "Ready"
```
NAME STATUS ROLES AGE VERSION
dev-control-plane Ready control-plane 5d5h v1.27.2
dev-worker Ready <none> 5d5h v1.27.2
dev-worker2 Ready <none> 5d5h v1.27.2
dev-worker3 Ready <none> 5d5h v1.27.2
```
3. Déployer les opérateurs dans votre cluster
```shell
kubectl apply -k misc/k8s/${ENGINE}/cluster --server-side
```
4. Récupèrer la plage IP de votre "cluster"
Si vous utilisez [kind](https://kind.sigs.k8s.io) :
```shell
docker network inspect kind | jq '.[0].IPAM.Config[0].Subnet' -r
```
En toute logique vous devriez obtenir un résultat du type `172.XX.0.0/16`.
Gardez cette information pour plus tard.
```
your-project/
├── assets/
@ -20,4 +70,4 @@ your-project/
├── translations/
├── var/
└── vendor/
```
```

View File

@ -0,0 +1,3 @@
ARG ADDITIONAL_PACKAGES="tree"
FROM reg.cadoles.com/cadoles/symfony:alpine-php-8.1-base

View File

@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://raw.githubusercontent.com/ory/k8s/v0.30.0/helm/charts/hydra-maester/crds/crd-oauth2clients.yaml
- https://forge.cadoles.com/CadolesKube/c-kustom//base/cloudnative-pg-operator?ref=develop
- https://forge.cadoles.com/CadolesKube/c-kustom//base/redis?ref=develop
- https://forge.cadoles.com/CadolesKube/c-kustom//base/minio?ref=develop
- https://forge.cadoles.com/CadolesKube/c-kustom//base/metallb?ref=develop
- https://forge.cadoles.com/CadolesKube/c-kustom//base/metrics?ref=develop
- https://forge.cadoles.com/CadolesKube/c-kustom//base/nginx?ref=develop

View File

@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: metallb-system
resources:
- ./resources/ipaddresspoool.yaml
- ./resources/advertise.yaml

View File

@ -0,0 +1,9 @@
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: l2-ip-pool-ad
namespace: metallb-system
spec:
ipAddressPools:
- main-pool

View File

@ -0,0 +1,8 @@
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: main-pool
namespace: metallb-system
spec:
addresses:
- 172.18.10.100-172.18.10.200

View File

@ -0,0 +1,48 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: mse-dev
networking:
podSubnet: "10.110.0.0/16"
serviceSubnet: "10.115.0.0/16"
nodes:
- role: control-plane
image: kindest/node:v1.27.2
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 31000
hostPort: 31000
listenAddress: "0.0.0.0" # Optional, defaults to "0.0.0.0"
- containerPort: 80
hostPort: 8080
listenAddress: "0.0.0.0" # Optional, defaults to "0.0.0.0"
labels:
ingress-ready: true
- role: worker
image: kindest/node:v1.27.2
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
system-reserved: memory=2Gi
- role: worker
image: kindest/node:v1.27.2
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
system-reserved: memory=2Gi
- role: worker
image: kindest/node:v1.27.2
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
system-reserved: memory=2Gi