Last active
March 28, 2023 12:42
-
-
Save robdewit/9a09626c69b61b892c0c378378b26411 to your computer and use it in GitHub Desktop.
Kubernetes glusterfs in pod template
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
# Mock service | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
namespace: MY_NAMESPACE | |
name: MY_APPNAME_VOLNAME | |
spec: | |
ports: | |
- port: 1 | |
--- | |
# Actual endpoitns where gluster cluster lives | |
# Suppose the gluster volume is called GLUSTER_VOLNAME | |
apiVersion: v1 | |
kind: Endpoints | |
metadata: | |
namespace: MY_NAMESPACE | |
name: MY_APPNAME_VOLNAME | |
subsets: | |
- addresses: | |
- ip: 10.10.0.67 | |
ports: | |
- port: 1 | |
- addresses: | |
- ip: 10.10.0.68 | |
ports: | |
- port: 1 | |
- addresses: | |
- ip: 10.10.0.116 | |
ports: | |
- port: 1 | |
--- | |
# How to use it in a deployment | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
annotations: | |
labels: | |
app: MY_APPNAME | |
name: MY_APPNAME | |
namespace: MY_NAMESPACE | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: MY_APPNAME | |
strategy: | |
rollingUpdate: | |
maxSurge: 1 | |
maxUnavailable: 1 | |
type: RollingUpdate | |
template: | |
metadata: | |
labels: | |
app: MY_APPNAME | |
namespace: MY_NAMESPACE | |
spec: | |
containers: | |
- name: MY_APPNAME | |
image: MY_DOCKER_IMAGE | |
volumeMounts: | |
- mountPath: MY_PATH_IN_POD | |
name: MY_MOUNT_NAME | |
securityContext: | |
readOnlyRootFilesystem: true | |
volumes: | |
- name: MY_MOUNT_NAME | |
glusterfs: | |
endpoints: MY_APPNAME_VOLNAME | |
path: GLUSTER_VOLNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment