initial commit
This commit is contained in:
commit
99a66f4cfd
15 changed files with 287 additions and 0 deletions
23
k8s/configure-metallb.sh
Executable file
23
k8s/configure-metallb.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
usage () {
|
||||
echo "usage: $0 ip"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ $# -eq 1 ]] || usage
|
||||
ip="$1"
|
||||
|
||||
cd "$(dirname $0)"
|
||||
|
||||
sed "s!<IP>!${ip}!" ./metallb.yaml.template > ./metallb.yaml
|
||||
|
||||
echo "Configuring metallb..."
|
||||
kubectl apply -f ./metallb.yaml
|
||||
echo "Configuring services..."
|
||||
for i in ./svc-*.yaml; do
|
||||
svc="$(grep -Po "name: \Kpdp-.*$" "$i")"
|
||||
kubectl patch svc "$svc" -p '{"metadata":{"annotations":{"metallb.universe.tf/allow-shared-ip":"'"$ip"'"}},"spec":{"type": "LoadBalancer","loadBalancerIP":"'"$ip"'"}}'
|
||||
done
|
||||
echo "Done!"
|
29
k8s/deployment.yaml.template
Normal file
29
k8s/deployment.yaml.template
Normal file
|
@ -0,0 +1,29 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: pdp
|
||||
labels:
|
||||
app.kubernetes.io/name: pdp
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: pdp
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: pdp
|
||||
spec:
|
||||
volumes:
|
||||
- name: disk
|
||||
persistentVolumeClaim:
|
||||
claimName: pdp-disk
|
||||
containers:
|
||||
- name: pdp
|
||||
image: <TAG>
|
||||
volumeMounts:
|
||||
- name: disk
|
||||
mountPath: /mnt
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: true
|
||||
privileged: true
|
15
k8s/metallb.yaml.template
Normal file
15
k8s/metallb.yaml.template
Normal file
|
@ -0,0 +1,15 @@
|
|||
apiVersion: metallb.io/v1beta1
|
||||
kind: IPAddressPool
|
||||
metadata:
|
||||
name: pdp
|
||||
namespace: metallb-system
|
||||
spec:
|
||||
addresses:
|
||||
- <IP>/32
|
||||
autoAssign: false
|
||||
---
|
||||
apiVersion: metallb.io/v1beta1
|
||||
kind: L2Advertisement
|
||||
metadata:
|
||||
name: default-l2
|
||||
namespace: metallb-system
|
17
k8s/pod-tmp.yaml
Normal file
17
k8s/pod-tmp.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: pdp-tmp
|
||||
spec:
|
||||
volumes:
|
||||
- name: disk
|
||||
persistentVolumeClaim:
|
||||
claimName: pdp-disk
|
||||
containers:
|
||||
- name: pdp
|
||||
image: alpine
|
||||
command: ["sleep", "infinity"]
|
||||
volumeMounts:
|
||||
- name: disk
|
||||
mountPath: /mnt
|
||||
restartPolicy: Never
|
10
k8s/pvc.yaml
Normal file
10
k8s/pvc.yaml
Normal file
|
@ -0,0 +1,10 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: pdp-disk
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
12
k8s/svc-ftp.yaml
Normal file
12
k8s/svc-ftp.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pdp-ftp
|
||||
labels:
|
||||
app.kubernetes.io/name: pdp
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: pdp
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 21
|
12
k8s/svc-http.yaml
Normal file
12
k8s/svc-http.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pdp-http
|
||||
labels:
|
||||
app.kubernetes.io/name: pdp
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: pdp
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
12
k8s/svc-telnet.yaml
Normal file
12
k8s/svc-telnet.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pdp-telnet
|
||||
labels:
|
||||
app.kubernetes.io/name: pdp
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: pdp
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 23
|
Loading…
Add table
Add a link
Reference in a new issue