k8s 部署minio
1.编辑yaml
cat > 01-minio-pvc.yaml <<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: minio-pvcnamespace: minio
spec:accessModes:- ReadWriteManyresources:requests:storage: 10GistorageClassName: nfs-boge
EOFcat > 02-minio.yaml<<'EOF'
# 报错版本不兼容:error: unable to recognize "minio.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"
# kubectl explain statefulsets |grep VERSION
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:name: minionamespace: minio
spec:replicas: 1selector:matchLabels:app: miniotemplate:metadata:labels:app: miniospec:containers:- name: minioenv:- name: MINIO_ROOT_USERvalue: "admin"- name: MINIO_ROOT_PASSWORDvalue: "root123456"image: registry.cn-hangzhou.aliyuncs.com/rwit/minio:latestimagePullPolicy: IfNotPresentcommand:- /bin/sh- -c- minio server /data --console-address ":5000"ports:- name: datacontainerPort: 9000protocol: "TCP"- name: consolecontainerPort: 5000protocol: "TCP"volumeMounts:- name: minio-datamountPath: /data- name: date-configmountPath: /etc/localtimevolumes:- name: date-confighostPath:path: /usr/share/zoneinfo/Asia/Shanghai- name: minio-datapersistentVolumeClaim:claimName: minio-pvc
---
apiVersion: v1
kind: Service
metadata:name: minionamespace: minio
spec:type: NodePortports:- name: dataport: 9000targetPort: 9000protocol: TCPnodePort: 32001- name: consoleport: 5000targetPort: 5000protocol: TCPnodePort: 32002selector:app: minio
---
#apiVersion: apps/v1
apiVersion: extensions/v1beta1
kind: Ingress
metadata:name: minionamespace: minio
spec:rules:- host: minio.e2.comhttp:paths:- path: /backend:serviceName: minioservicePort: 5000
EOF
2.执行部署命令
kubectl apply -f 01-minio-pvc.yamlkubectl apply -f 02-minio.yamlkubectl -n minio get all