0

I am trying to install velero and minio for my k8s cluster. I have one master and 2 worker nodes. I have issue with NodePort service.

Overall pods are working and Node Port service is also running but when I try to access the minio Dashboard from browser It change Port number. I thought that issue is with my service so I also created another question for that.

Actual problem is with Console port.

When I run kubectl logs minio-8649b94fb5-8cr2k -n velero I see this information .

WARNING: MINIO_ACCESS_KEY and MINIO_SECRET_KEY are deprecated.
         Please use MINIO_ROOT_USER and MINIO_ROOT_PASSWORD
Formatting 1st pool, 1 set(s), 1 drives per set.
WARNING: Host local has more than 0 drives of set. A host failure will result in data becoming unavailable.
MinIO Object Storage Server
Copyright: 2015-2023 MinIO, Inc.
License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
Version: RELEASE.2023-01-25T00-19-54Z (go1.19.4 linux/amd64)

Status:         1 Online, 0 Offline.
API: http://10.244.2.136:9000  http://127.0.0.1:9000
Console: http://10.244.2.136:37269 http://127.0.0.1:37269

Documentation: https://min.io/docs/minio/linux/index.html
Warning: The standard parity is set to 0. This can lead to data loss.

The port number of

Console: http://10.244.2.136:37269 http://127.0.0.1:37269 is different than the port of Node Port service.

This is my NodePort Service

master-k8s@masterk8s-virtual-machine:~/velero-v1.2.0-darwin-amd64$ kubectl get svc -n velero
NAME    TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
minio   NodePort   10.97.197.54   <none>        9000:30480/TCP   82m

When I search the URL in browser with service port number it convert to console port and I am not able to access my application.

What I have done to fix this:

  1. I try to use Load balancer services and still not able to access the Application.
  2. I also assign the NodePort in service.yaml file It stop changing the port but I am not able to access the Application.
  3. I change the Ports in application and service still the same issue.
  4. Log have noting but this information.
  5. I try to install minio directly on my Ubuntu VM and it was successful.

What do I want:

I have done everything I could do. I don't find any issue like that or any information related to this topic. Any advice will be very help to fix this issue. How can I change the port of console or make it sync with service port?

Updated yaml

apiVersion: v1
kind: Namespace
metadata:
  name: velero

---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: minio
  name: minio
  labels:
    component: minio
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      component: minio
  template:
    metadata:
      labels:
        component: minio
    spec:
      volumes:
      - name: storage
        emptyDir: {}
      - name: config
        emptyDir: {}
      containers:
      - name: minio
        image: minio/minio:latest
        imagePullPolicy: IfNotPresent
        args:
        - server
        - /storage
        - --console-address=:9090
        - --config-dir=/config
        env:
        - name: MINIO_ACCESS_KEY
          value: "minio"
        - name: MINIO_SECRET_KEY
          value: "minio123"
        ports:
        - containerPort: 9000
          name: api
        - containerPort: 9090
          name: console
        volumeMounts:
        - name: storage
          mountPath: "/storage"
        - name: config
          mountPath: "/config"

---
apiVersion: v1
kind: Service
metadata:
  namespace: minio
  name: minio-service
  labels:
    component: minio
spec:
  # ClusterIP is recommended for production environments.
  # Change to NodePort if needed per documentation,
  # but only if you run Minio in a test/trial environment, for example with Minikube.
  type: LoadBalancer
  ports:
    - port: 9000
      targetPort: 9000
      protocol: TCP
  selector:
    component: minio

---
apiVersion: batch/v1
kind: Job
metadata:
  namespace: minio
  name: minio-setup
  labels:
    component: minio
spec:
  template:
    metadata:
      name: minio-setup
    spec:
      restartPolicy: OnFailure
      volumes:
      - name: config
        emptyDir: {}
      containers:
      - name: mc
        image: minio/mc:latest
        imagePullPolicy: IfNotPresent
        command:
        - /bin/sh
        - -c
        - "mc --config-dir=/config config host add velero http://minio:9000 minio minio123 && mc --config-dir=/config mb -p velero/velero"
        volumeMounts:
        - name: config
          mountPath: "/config"
      
  • You will first need to configure minio to [use a static port for the console](https://min.io/docs/minio/linux/administration/minio-console.html#id4). Then you would map that to a service the same way you do for the API. – larsks Jan 27 '23 at 14:53
  • If you've made that change and you're still having problems, please update your question to include an [mcve] -- ideally, the Deployment and Service manifests you're using, so that we can try to reproduce the problem locally. – larsks Jan 27 '23 at 15:21
  • Larsks, This documentation shows how to set static Port of Linux OS or Windows. I am using k8s. I have deployment.yaml file. I am not sure how can I assign this. I am new to k8s. Can you please provide me any example. I really really appreciate if you can. – tauqeerahmad24 Jan 27 '23 at 15:39
  • That documentation shows how to set up a static console port for minio *regardless* of how you're deploying it. You need to add the `--console-address` argument to the `minio server` invocation. Take a look at the [example kubernetes deployment](https://min.io/docs/minio/kubernetes/upstream/index.html) provided by minio, which does exactly that [in the pod manifest](https://raw.githubusercontent.com/minio/docs/master/source/extra/examples/minio-dev.yaml). – larsks Jan 27 '23 at 15:43
  • Hi, Manifest, I updated my yaml file and also the service type. I am not able to access dashboard still. I have updated the Question with new yaml file. Can you please help me to find what did I do wrong? Really Thanks. – tauqeerahmad24 Feb 01 '23 at 17:36

1 Answers1

2

We need to tell Minio to use a static console port. We can do that by providing the --console-address argument to the minio server command. Here's an example Deployment that I have used to run Minio locally:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: minio
  name: minio
  namespace: minio
spec:
  replicas: 1
  selector:
    matchLabels:
      app: minio
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: minio
    spec:
      containers:
      - command:
        - minio
        - server
        - /data
        - --console-address=:9090
        envFrom:
        - secretRef:
            name: minio-creds-9d9kmkc4m4
        image: quay.io/minio/minio:latest
        name: minio
        ports:
        - containerPort: 9000
          name: api
        - containerPort: 9090
          name: console
        volumeMounts:
        - mountPath: /data
          name: minio-data
      volumes:
      - name: minio-data
        persistentVolumeClaim:
          claimName: minio-data

This runs minio server /data --console-address=:9090; when Minio starts up, we see in the logs:

Status:         1 Online, 0 Offline.
API: http://10.244.0.11:9000  http://127.0.0.1:9000
Console: http://10.244.0.11:9090 http://127.0.0.1:9090

Now that we have a static port, we can set up the NodePort service you want:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: minio
  name: minio
  namespace: minio
spec:
  ports:
  - name: api
    nodePort: 30900
    port: 9000
    protocol: TCP
    targetPort: api
  - name: console
    nodePort: 30990
    port: 9090
    protocol: TCP
    targetPort: console
  selector:
    app: minio
  type: NodePort

This exposes the API on port 30900 and the console on port 30990.


You can find my complete test including manifests and deployment instructions at https://github.com/larsks/k8s-example-minio/.

larsks
  • 277,717
  • 41
  • 399
  • 399
  • Hi Larsks, I have updated the deployment and services but and now I am not able to access the dashboard. I have updated the Question, can you please tell me what I did wrong? Thanks. – tauqeerahmad24 Feb 01 '23 at 17:38
  • 1
    You don't appear to be exposing the dashboard anywhere. Your services only references the API port (9000), but contains no reference to the dashboard port (9010). – larsks Feb 02 '23 at 01:01
  • Hi Larsk really thanks for your help and point out my mistake. All works now. Thanks to all. – tauqeerahmad24 Feb 02 '23 at 07:41
  • If this answer helped you solve your problem, please consider marking the checkmark to the left of the answer to mark it as "accepted". – larsks Feb 02 '23 at 12:53