mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Updated as per review comments.
This commit is contained in:
parent
32707fb318
commit
26e274e3c9
@ -42,7 +42,7 @@ kubectl create -f https://github.com/kubernetes/kubernetes/blob/master/examples/
|
|||||||
|
|
||||||
## Step 1: Create Minio Headless Service
|
## Step 1: Create Minio Headless Service
|
||||||
|
|
||||||
Headless Service controls the domain within which we create StatefulSets. The domain managed by this Service takes the form: `$(service name).$(namespace).svc.cluster.local` (where “cluster.local” is the cluster domain), and the pods in this domain take the form: `$(pod-name-{i}).$(service name).$(namespace).svc.cluster.local`. This is required to get a DNS resolvable URL for each of the pods created within the Statefulset.
|
Headless Service controls the domain within which StatefulSets are created. The domain managed by this Service takes the form: `$(service name).$(namespace).svc.cluster.local` (where “cluster.local” is the cluster domain), and the pods in this domain take the form: `$(pod-name-{i}).$(service name).$(namespace).svc.cluster.local`. This is required to get a DNS resolvable URL for each of the pods created within the Statefulset.
|
||||||
|
|
||||||
This is the Headless service description.
|
This is the Headless service description.
|
||||||
|
|
||||||
@ -61,16 +61,11 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
app: minio
|
app: minio
|
||||||
```
|
```
|
||||||
[Download example] (minio-distributed-headless-service.yaml?raw=true)
|
|
||||||
|
|
||||||
Create the Headless Service
|
Create the Headless Service
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl create -f minio-distributed-headless-service.yaml
|
$ kubectl create -f https://github.com/kubernetes/kubernetes/blob/master/examples/storage/minio-distributed/minio-distributed-headless-service.yaml?raw=true
|
||||||
```
|
|
||||||
The response should be like this:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
service "minio" created
|
service "minio" created
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -86,7 +81,7 @@ kind: StatefulSet
|
|||||||
metadata:
|
metadata:
|
||||||
name: minio
|
name: minio
|
||||||
spec:
|
spec:
|
||||||
serviceName: "minio"
|
serviceName: minio
|
||||||
replicas: 4
|
replicas: 4
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
@ -103,8 +98,14 @@ spec:
|
|||||||
- name: MINIO_SECRET_KEY
|
- name: MINIO_SECRET_KEY
|
||||||
value: "minio123"
|
value: "minio123"
|
||||||
image: minio/minio
|
image: minio/minio
|
||||||
command: ["minio"]
|
command:
|
||||||
args: ["server", "http://minio-0.minio.default.svc.cluster.local/data", "http://minio-1.minio.default.svc.cluster.local/data", "http://minio-2.minio.default.svc.cluster.local/data", "http://minio-3.minio.default.svc.cluster.local/data"]
|
- minio
|
||||||
|
args:
|
||||||
|
- server
|
||||||
|
- http://minio-0.minio.default.svc.cluster.local/data
|
||||||
|
- http://minio-1.minio.default.svc.cluster.local/data
|
||||||
|
- http://minio-2.minio.default.svc.cluster.local/data
|
||||||
|
- http://minio-3.minio.default.svc.cluster.local/data
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 9000
|
- containerPort: 9000
|
||||||
hostPort: 9000
|
hostPort: 9000
|
||||||
@ -121,23 +122,17 @@ spec:
|
|||||||
annotations:
|
annotations:
|
||||||
volume.alpha.kubernetes.io/storage-class: anything
|
volume.alpha.kubernetes.io/storage-class: anything
|
||||||
spec:
|
spec:
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 10Gi
|
storage: 10Gi
|
||||||
```
|
```
|
||||||
|
|
||||||
[Download example] (minio-distributed-statefulset.yaml?raw=true)
|
|
||||||
|
|
||||||
Create the Statefulset
|
Create the Statefulset
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl create -f minio-distributed-statefulset.yaml
|
$ kubectl create -f https://github.com/kubernetes/kubernetes/blob/master/examples/storage/minio-distributed/minio-distributed-statefulset.yaml?raw=true
|
||||||
```
|
|
||||||
|
|
||||||
The response should be like this
|
|
||||||
|
|
||||||
```sh
|
|
||||||
statefulset "minio" created
|
statefulset "minio" created
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -159,35 +154,26 @@ spec:
|
|||||||
targetPort: 9000
|
targetPort: 9000
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
selector:
|
selector:
|
||||||
app: minio-server
|
app: minio
|
||||||
```
|
```
|
||||||
|
Create the Minio service
|
||||||
[Download example] (minio-distributed-service.yaml?raw=true)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
kubectl create -f minio-distributed-service.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
The response should be like this
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
$ kubectl create -f https://github.com/kubernetes/kubernetes/blob/master/examples/storage/minio-distributed/minio-distributed-service.yaml?raw=true
|
||||||
service "minio-service" created
|
service "minio-service" created
|
||||||
```
|
```
|
||||||
To check if the service was created successfully, run the command
|
|
||||||
|
The `LoadBalancer` service takes couple of minutes to launch. To check if the service was created successfully, run the command
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl get svc minio-service
|
$ kubectl get svc minio-service
|
||||||
```
|
|
||||||
|
|
||||||
You should get a response like this
|
|
||||||
```sh
|
|
||||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
minio-service 10.55.248.23 104.199.249.165 9000:31852/TCP 1m
|
minio-service 10.55.248.23 104.199.249.165 9000:31852/TCP 1m
|
||||||
```
|
```
|
||||||
|
|
||||||
# Step 4: Resource cleanup
|
# Step 4: Resource cleanup
|
||||||
|
|
||||||
Once you are done, cleanup the cluster using
|
You can cleanup the cluster using
|
||||||
```sh
|
```sh
|
||||||
kubectl delete statefulset minio \
|
kubectl delete statefulset minio \
|
||||||
&& kubectl delete svc minio \
|
&& kubectl delete svc minio \
|
||||||
|
@ -2,14 +2,11 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: minio-service
|
name: minio-service
|
||||||
labels:
|
|
||||||
app: minio
|
|
||||||
spec:
|
spec:
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
ports:
|
ports:
|
||||||
- port: 9000
|
- port: 9000
|
||||||
targetPort: 9000
|
targetPort: 9000
|
||||||
protocol: "TCP"
|
protocol: TCP
|
||||||
name: minio
|
|
||||||
selector:
|
selector:
|
||||||
app: minio
|
app: minio
|
||||||
|
@ -3,7 +3,7 @@ kind: StatefulSet
|
|||||||
metadata:
|
metadata:
|
||||||
name: minio
|
name: minio
|
||||||
spec:
|
spec:
|
||||||
serviceName: "minio"
|
serviceName: minio
|
||||||
replicas: 4
|
replicas: 4
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
@ -20,8 +20,14 @@ spec:
|
|||||||
- name: MINIO_SECRET_KEY
|
- name: MINIO_SECRET_KEY
|
||||||
value: "minio123"
|
value: "minio123"
|
||||||
image: minio/minio
|
image: minio/minio
|
||||||
command: ["minio"]
|
command:
|
||||||
args: ["server", "http://minio-0.minio.default.svc.cluster.local/data", "http://minio-1.minio.default.svc.cluster.local/data", "http://minio-2.minio.default.svc.cluster.local/data", "http://minio-3.minio.default.svc.cluster.local/data"]
|
- minio
|
||||||
|
args:
|
||||||
|
- server
|
||||||
|
- http://minio-0.minio.default.svc.cluster.local/data
|
||||||
|
- http://minio-1.minio.default.svc.cluster.local/data
|
||||||
|
- http://minio-2.minio.default.svc.cluster.local/data
|
||||||
|
- http://minio-3.minio.default.svc.cluster.local/data
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 9000
|
- containerPort: 9000
|
||||||
hostPort: 9000
|
hostPort: 9000
|
||||||
@ -38,7 +44,8 @@ spec:
|
|||||||
annotations:
|
annotations:
|
||||||
volume.alpha.kubernetes.io/storage-class: anything
|
volume.alpha.kubernetes.io/storage-class: anything
|
||||||
spec:
|
spec:
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 10Gi
|
storage: 10Gi
|
||||||
|
@ -67,16 +67,11 @@ spec:
|
|||||||
requests:
|
requests:
|
||||||
storage: 10Gi
|
storage: 10Gi
|
||||||
```
|
```
|
||||||
[Download example] (minio-standalone-pvc.yaml?raw=true)
|
|
||||||
|
|
||||||
Create the PersistentVolumeClaim
|
Create the PersistentVolumeClaim
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl create -f minio-standalone-pvc.yaml
|
kubectl create -f https://github.com/kubernetes/kubernetes/blob/master/examples/storage/minio/minio-standalone-pvc.yaml?raw=true
|
||||||
```
|
|
||||||
The response should be like this:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
persistentvolumeclaim "minio-pv-claim" created
|
persistentvolumeclaim "minio-pv-claim" created
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -99,7 +94,7 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
# Label is used as selector in the service.
|
# Label is used as selector in the service.
|
||||||
app: minio-server
|
app: minio
|
||||||
spec:
|
spec:
|
||||||
# Refer to the PVC created earlier
|
# Refer to the PVC created earlier
|
||||||
volumes:
|
volumes:
|
||||||
@ -111,8 +106,11 @@ spec:
|
|||||||
- name: minio
|
- name: minio
|
||||||
# Pulls the default Minio image from Docker Hub
|
# Pulls the default Minio image from Docker Hub
|
||||||
image: minio/minio
|
image: minio/minio
|
||||||
command: ["minio"]
|
command:
|
||||||
args: ["server", "/storage"]
|
- minio
|
||||||
|
args:
|
||||||
|
- server
|
||||||
|
- /storage
|
||||||
env:
|
env:
|
||||||
# Minio access key and secret key
|
# Minio access key and secret key
|
||||||
- name: MINIO_ACCESS_KEY
|
- name: MINIO_ACCESS_KEY
|
||||||
@ -128,17 +126,10 @@ spec:
|
|||||||
mountPath: "/storage"
|
mountPath: "/storage"
|
||||||
```
|
```
|
||||||
|
|
||||||
[Download example] (minio-standalone-deployment.yaml?raw=true)
|
|
||||||
|
|
||||||
Create the Deployment
|
Create the Deployment
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl create -f minio-standalone-deployment.yaml
|
kubectl create -f https://github.com/kubernetes/kubernetes/blob/master/examples/storage/minio/minio-standalone-deployment.yaml?raw=true
|
||||||
```
|
|
||||||
|
|
||||||
The response should be like this
|
|
||||||
|
|
||||||
```sh
|
|
||||||
deployment "minio-deployment" created
|
deployment "minio-deployment" created
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -160,28 +151,19 @@ spec:
|
|||||||
targetPort: 9000
|
targetPort: 9000
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
selector:
|
selector:
|
||||||
app: minio-server
|
app: minio
|
||||||
```
|
```
|
||||||
|
Create the Minio service
|
||||||
[Download example] (minio-standalone-service.yaml?raw=true)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
kubectl create -f minio-standalone-service.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
The response should be like this
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
kubectl create -f https://github.com/kubernetes/kubernetes/blob/master/examples/storage/minio/minio-standalone-service.yaml?raw=true
|
||||||
service "minio-service" created
|
service "minio-service" created
|
||||||
```
|
```
|
||||||
To check if the service was created successfully, run the command
|
|
||||||
|
The `LoadBalancer` service takes couple of minutes to launch. To check if the service was created successfully, run the command
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl get svc minio-service
|
kubectl get svc minio-service
|
||||||
```
|
|
||||||
|
|
||||||
You should get a response like this
|
|
||||||
```sh
|
|
||||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
minio-service 10.55.248.23 104.199.249.165 9000:31852/TCP 1m
|
minio-service 10.55.248.23 104.199.249.165 9000:31852/TCP 1m
|
||||||
```
|
```
|
||||||
|
@ -10,7 +10,7 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
# Label is used as selector in the service.
|
# Label is used as selector in the service.
|
||||||
app: minio-server
|
app: minio
|
||||||
spec:
|
spec:
|
||||||
# Refer to the PVC created earlier
|
# Refer to the PVC created earlier
|
||||||
volumes:
|
volumes:
|
||||||
@ -22,8 +22,11 @@ spec:
|
|||||||
- name: minio
|
- name: minio
|
||||||
# Pulls the default Minio image from Docker Hub
|
# Pulls the default Minio image from Docker Hub
|
||||||
image: minio/minio
|
image: minio/minio
|
||||||
command: ["minio"]
|
command:
|
||||||
args: ["server", "/storage"]
|
- minio
|
||||||
|
args:
|
||||||
|
- server
|
||||||
|
- /storage
|
||||||
env:
|
env:
|
||||||
# Minio access key and secret key
|
# Minio access key and secret key
|
||||||
- name: MINIO_ACCESS_KEY
|
- name: MINIO_ACCESS_KEY
|
||||||
|
@ -9,4 +9,4 @@ spec:
|
|||||||
targetPort: 9000
|
targetPort: 9000
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
selector:
|
selector:
|
||||||
app: minio-server
|
app: minio
|
||||||
|
Loading…
Reference in New Issue
Block a user