<p>I am trying to install the velero for k8s. During the installation when try to install mini.io I changes its service type from cluster IP to Node Port. My Pods run successfully and also I can see the node Port services is up and running.</p>
<pre><code>master-k8s@masterk8s-virtual-machine:~/velero-v1.9.5-linux-amd64$ kubectl get pods -n velero -owide              NAME                     READY   STATUS    RESTARTS   AGE   IP             NODE                       NOMINATED NODE   READINESS GATES
minio-8649b94fb5-vk7gv   1/1     Running   0          16m   10.244.1.102   node1k8s-virtual-machine   &lt;none&gt;           &lt;none&gt;
master-k8s@masterk8s-virtual-machine:~/velero-v1.9.5-linux-amd64$ kubectl get svc -n velero                      NAME    TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
minio   NodePort   10.111.72.207   &lt;none&gt;        9000:31481/TCP   53m
</code></pre>
<p>When I try to access my services port number changes from <strong>31481</strong> to <strong>45717</strong> by it self. Every time when I correct port number and hit enter it changes back to new port and I am not able to access my application.</p>
<p>These are my codes from mini.io service file.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  namespace: velero
  name: minio
  labels:
    component: minio
spec:
  type: NodePort
  ports:
    - port: 9000
      targetPort: 9000
      protocol: TCP
  selector:
    component: minio
</code></pre>
<p><strong>What I have done so far?</strong></p>
<p>I look for the log and everything show successful No error. I also try it with Load balancer service. With Load balancer port not not changes but I am not able to access the application.
Noting found on google about this issue.
I also check all the namespaces pods and services to check if these Port numbers are being used. No services use these ports.</p>
<p><strong>What Do I want?</strong>
Can you please help me to find out what cause my application to change its port. Where is the issue and how to fix it.? How can I access application dashbord?</p>
<p><strong>Update Question</strong></p>
<p>This is the full codes file. It may help to find my mistake.</p>
<pre><code>apiVersion: v1
kind: Namespace
metadata:
  name: velero

---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: velero
  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
        - --config-dir=/config
        env:
        - name: MINIO_ACCESS_KEY
          value: &quot;minio&quot;
        - name: MINIO_SECRET_KEY
          value: &quot;minio123&quot;
        ports:
        - containerPort: 9002
        volumeMounts:
        - name: storage
          mountPath: &quot;/storage&quot;
        - name: config
          mountPath: &quot;/config&quot;

---
apiVersion: v1
kind: Service
metadata:
  namespace: velero
  name: minio
  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: NodePort
  ports:
    - port: 9002
      nodePort: 31482
      targetPort: 9002
      protocol: TCP
  selector:
    component: minio

---
apiVersion: batch/v1
kind: Job
metadata:
  namespace: velero
  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
        - &quot;mc --config-dir=/config config host add velero http://minio:9000 minio minio123 &amp;&amp; mc --config-dir=/config mb -p velero/velero&quot;
        volumeMounts:
        - name: config
          mountPath: &quot;/config&quot;
</code></pre>
<p><strong>Edit2 Logs Of Pod</strong></p>
<pre><code>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 &lt;https://www.gnu.org/licenses/agpl-3.0.html&gt;
Version: RELEASE.2023-01-25T00-19-54Z (go1.19.4 linux/amd64)

Status:         1 Online, 0 Offline.
API: http://10.244.1.108:9000  http://127.0.0.1:9000
Console: http://10.244.1.108:33045 http://127.0.0.1:33045

Documentation: https://min.io/docs/minio/linux/index.html
Warning: The standard parity is set to 0. This can lead to data loss.
</code></pre>
<p><strong>Edit 3 Logs of Pod</strong></p>
<pre><code>master-k8s@masterk8s-virtual-machine:~/velero-1.9.5$ kubectl logs minio-8649b94fb5-qvzfh -n velero
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 &lt;https://www.gnu.org/licenses/agpl-3.0.html&gt;
Version: RELEASE.2023-01-25T00-19-54Z (go1.19.4 linux/amd64)

Status:         1 Online, 0 Offline.
API: http://10.244.2.131:9000  http://127.0.0.1:9000
Console: http://10.244.2.131:36649 http://127.0.0.1:36649

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

tauqeerahmad24
<p>You can set the <code>nodePort</code> number inside the port config so that it won't be automatically set.</p>
<p>Try this Service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  namespace: velero
  name: minio
  labels:
    component: minio
spec:
  type: NodePort
  ports:
    - port: 9000
      nodePort: 31481
      targetPort: 9000
      protocol: TCP
  selector:
    component: minio
</code></pre>
