Skip to content

Instantly share code, notes, and snippets.

@clouditlab
Last active March 12, 2023 17:43
Show Gist options
  • Save clouditlab/c3d6a702f92016e60ac8d1f36a429d49 to your computer and use it in GitHub Desktop.
Save clouditlab/c3d6a702f92016e60ac8d1f36a429d49 to your computer and use it in GitHub Desktop.
METALLB example
apiVersion: v1
kind: ConfigMap
metadata:
name: itlab-app
data:
nginx.conf: '
events {
}
http {
server {
listen 80;
location / {
return 200 "$remote_addr - Hello IT Lab readers, today we are covering MetalLB!\n";
}
}
}
'
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: itlab-app
spec:
selector:
matchLabels:
owner: cloud-itlab
app: itlab-app
replicas: 2
template:
metadata:
labels:
owner: cloud-itlab
app: itlab-app
spec:
containers:
- name: itlab-app
image: nginx:latest
ports:
- containerPort: 80
volumeMounts:
- name: itlab-app-vol
mountPath: /etc/nginx/
volumes:
- name: itlab-app-vol
configMap:
name: itlab-app
items:
- key: nginx.conf
path: nginx.conf
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: itlab-pool
namespace: metallb-system
spec:
addresses:
- 192.168.122.232-192.168.122.240
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: itlab-advertisement
namespace: metallb-system
spec:
ipAddressPools:
- itlab-pool
apiVersion: v1
kind: Service
metadata:
name: itlab-app
labels:
app: itlab-app
spec:
type: LoadBalancer
ports:
- port: 80
protocol: TCP
selector:
app: itlab-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment