Add a skeleton k8s deployment setup

DNS will come later
This commit is contained in:
Jake Howard 2022-03-07 21:58:17 +00:00
parent 812e828862
commit 2093f72602
Signed by: jake
GPG Key ID: 57AFB45680EDD477
10 changed files with 100 additions and 17 deletions

View File

@ -1,17 +0,0 @@
extends: default
ignore: |
ansible/galaxy_roles
ansible/galaxy_collections
ansible/group_vars/all/hosts.yml
ansible/roles/traefik/files/traefik.yml
ansible/roles/nebula/files/nebula.yml
rules:
document-start: disable
truthy: disable
quoted-strings:
quote-type: double
required: only-when-needed
line-length:
max: 160

1
ansible/yamllint.yml Symbolic link
View File

@ -0,0 +1 @@
./yamllint.yml

4
k8s/kustomization.yml Normal file
View File

@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- whoami

24
k8s/whoami/deployment.yml Normal file
View File

@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami
spec:
selector:
matchLabels:
app: whoami
replicas: 2
template:
metadata:
labels:
app: whoami
spec:
containers:
- name: whoami
image: traefik/whoami
readinessProbe:
httpGet:
path: /
port: 80
ports:
- containerPort: 80
imagePullPolicy: Always

17
k8s/whoami/ingress.yml Normal file
View File

@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: whoami
spec:
ingressClassName: nginx
rules:
- host: whoami.localhost
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: whoami
port:
number: 80

View File

@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: whoami
resources:
- deployment.yml
- ingress.yml
- namespace.yml
- service.yml

4
k8s/whoami/namespace.yml Normal file
View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: whoami

13
k8s/whoami/service.yml Normal file
View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: whoami
labels:
app: whoami
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: whoami

5
scripts/k8s/apply.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -e
kubectl apply -k ./k8s

7
scripts/k8s/lint.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
PATH=${PWD}/env/bin:${PATH}
yamllint -c ./yamllint.yml ./k8s

17
yamllint.yml Normal file
View File

@ -0,0 +1,17 @@
extends: default
ignore: |
ansible/galaxy_roles
ansible/galaxy_collections
ansible/group_vars/all/hosts.yml
ansible/roles/traefik/files/traefik.yml
ansible/roles/nebula/files/nebula.yml
rules:
document-start: disable
truthy: disable
quoted-strings:
quote-type: double
required: only-when-needed
line-length:
max: 160