Skip to content

Instantly share code, notes, and snippets.

@grdnrio
Created September 29, 2020 14:15
Show Gist options
  • Save grdnrio/7e5c8940442a166aa6292b080dce1e24 to your computer and use it in GitHub Desktop.
Save grdnrio/7e5c8940442a166aa6292b080dce1e24 to your computer and use it in GitHub Desktop.
Minio Example
apiVersion: v1
kind: Namespace
metadata:
name: minio
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: minio-sc
provisioner: kubernetes.io/portworx-volume
parameters:
repl: "2"
io_profile: "cms"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
# This name uniquely identifies the PVC. This is used in deployment.
name: minio-pv-claim
namespace: minio
annotations:
volume.beta.kubernetes.io/storage-class: minio-sc
spec:
# Read more about access modes here: http://kubernetes.io/docs/user-guide/persistent-volumes/#access-modes
accessModes:
# The volume is mounted as read-write by a single node
- ReadWriteOnce
resources:
# This is the request for storage. Should be available in the cluster.
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
# This name uniquely identifies the service
name: minio-service
namespace: minio
spec:
type: NodePort
ports:
- port: 9000
targetPort: 9000
nodePort: 30221
protocol: TCP
selector:
# Looks for labels `app:minio` in the namespace and applies the spec
app: minio
---
apiVersion: apps/v1
kind: Deployment
metadata:
# This name uniquely identifies the Deployment
name: minio
namespace: minio
spec:
selector:
matchLabels:
app: minio
strategy:
# Specifies the strategy used to replace old Pods by new ones
# Refer: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
type: Recreate
template:
metadata:
labels:
# This label is used as a selector in Service definition
app: minio
spec:
# Volumes used by this deployment
volumes:
- name: data
# This volume is based on PVC
persistentVolumeClaim:
# Name of the PVC created earlier
claimName: minio-pv-claim
containers:
- name: minio
# Volume mounts for this container
volumeMounts:
# Volume 'data' is mounted to path '/data'
- name: data
mountPath: "/data"
# Pulls the lastest Minio image from Docker Hub
image: minio/minio:RELEASE.2019-09-05T23-24-38Z
args:
- server
- /data
env:
# MinIO access key and secret key
- name: MINIO_ACCESS_KEY
value: "minio"
- name: MINIO_SECRET_KEY
value: "minio123"
ports:
- containerPort: 9000
# Readiness probe detects situations when MinIO server instance
# is not ready to accept traffic. Kubernetes doesn't forward
# traffic to the pod while readiness checks fail.
readinessProbe:
httpGet:
path: /minio/health/ready
port: 9000
initialDelaySeconds: 120
periodSeconds: 20
# Liveness probe detects situations where MinIO server instance
# is not working properly and needs restart. Kubernetes automatically
# restarts the pods if liveness checks fail.
livenessProbe:
httpGet:
path: /minio/health/live
port: 9000
initialDelaySeconds: 120
periodSeconds: 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment