<p>I have the following <code>.yaml</code> file to install <code>redisinsights</code> in kubernetes, with persistence support.</p>
<pre><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: redisinsight-storage-class
provisioner: 'kubernetes.io/gce-pd'
parameters:
  type: 'pd-standard'
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: redisinsight-volume-claim
spec:
  storageClassName: redisinsight-storage-class
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: redisinsight #deployment name
  labels:
    app: redisinsight #deployment label
spec:
  replicas: 1 #a single replica pod
  selector:
    matchLabels:
      app: redisinsight #which pods is the deployment managing, as defined by the pod template
  template: #pod template
    metadata:
      labels:
        app: redisinsight #label for pod/s
    spec:
      initContainers:
        - name: change-data-dir-ownership
          image: alpine:3.6
          command:
            - chmod
            - -R
            - '777'
            - /db
          volumeMounts:
            - name: redisinsight
              mountPath: /db
      containers:
        - name: redisinsight #Container name (DNS_LABEL, unique)
          image: redislabs/redisinsight:1.6.1 #repo/image
          imagePullPolicy: Always #Always pull image
          volumeMounts:
            - name: redisinsight #Pod volumes to mount into the container's filesystem. Cannot be updated.
              mountPath: /db
          ports:
            - containerPort: 8001 #exposed conainer port and protocol
              protocol: TCP
      volumes:
        - name: redisinsight
          persistentVolumeClaim:
            claimName: redisinsight-volume-claim
---
apiVersion: v1
kind: Service
metadata:
  name: redisinsight
spec:
  ports:
    - port: 8001
      name: redisinsight
  type: LoadBalancer
  selector:
    app: redisinsight

</code></pre>
<p>However, it fails to launch and gives an error:</p>
<pre><code>INFO 2020-07-03 06:30:08,117 redisinsight_startup Registered SIGTERM handler
ERROR 2020-07-03 06:30:08,131 redisinsight_startup Error in main()
Traceback (most recent call last):
  File &quot;./startup.py&quot;, line 477, in main
ValueError: invalid literal for int() with base 10: 'tcp://10.69.9.111:8001'
Traceback (most recent call last):
  File &quot;./startup.py&quot;, line 495, in &lt;module&gt;
  File &quot;./startup.py&quot;, line 477, in main
ValueError: invalid literal for int() with base 10: 'tcp://10.69.9.111:8001'
</code></pre>
<p>But the same docker image, when run locally via docker as:</p>
<pre><code>docker run -v redisinsight:/db -p 8001:8001 redislabs/redisinsight
</code></pre>
<p>works fine. What am I doing wrong ?</p>
<p>It feels like redisinsights is trying to read port as an int but somehow gets a string and is confused. But I cannot understand how this works fine the local docker run.</p>

<p><strong>UPDATE:</strong></p>
<p><strong>RedisInsight's <a href="https://docs.redislabs.com/latest/ri/installing/install-k8s/" rel="nofollow noreferrer">kubernetes documentation</a> has been updated recently. It clearly describes how to create a RedisInsight k8s deployment with and without a service.</strong></p>
<p><strong>IT also <a href="https://docs.redislabs.com/latest/ri/installing/install-k8s/#create-the-redisinsight-deployment-without-a-service" rel="nofollow noreferrer">explains</a> what to do when there's a service named &quot;redisinsight&quot; already:</strong></p>
<blockquote>
<p>Note - If the deployment will be exposed by a service whose name is ‘redisinsight’, set REDISINSIGHT_HOST and REDISINSIGHT_PORT environment variables to override the environment variables created by the service.</p>
</blockquote>
<hr />
<p>The problem is with the name of the service.</p>
<p>From the <a href="https://docs.redislabs.com/latest/ri/installing/configurations/" rel="nofollow noreferrer">documentation</a>, it is mentioned that RedisInsight has an environment variable <code>REDISINSIGHT_PORT</code> which can configure the port in which RedisInsight can run.</p>
<p>When you create a service in Kubernetes, all the pods that match the service, gets an environment variable <code>&lt;SERVICE_NAME&gt;_PORT=&lt;SERVICE_IP&gt;:&lt;SERVICE_PORT&gt;</code>.</p>
<p>So when you try to create the above mentioned service with name <code>redisinsight</code>, Kubernetes passes the service environment variable <code>REDISINSIGHT_PORT=&lt;SERVICE_IP&gt;:SERVICE_PORT</code>. But the port environment variable (<code>REDISINSIGHT_PORT</code>) is documented to be a <strong>port number</strong> and not an <strong>endpoint</strong> which makes the pod to crash when redisinsight running on the pod tries to use the environment variable as the port number.</p>
<p>So change the name of the service to be something different and not <code>redisinsight</code> and it should work.</p>
<p>Here's a quick deployment and service file:</p>
<p><strong>Deployment:</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: redisinsight #deployment name
  labels:
    app: redisinsight #deployment label
spec:
  replicas: 1 #a single replica pod
  selector:
    matchLabels:
      app: redisinsight #which pods is the deployment managing, as defined by the pod template
  template: #pod template
    metadata:
      labels:
        app: redisinsight #label for pod/s
    spec:
      containers:
      - name:  redisinsight #Container name (DNS_LABEL, unique)
        image: redislabs/redisinsight:1.6.3 #repo/image
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: db #Pod volumes to mount into the container's filesystem. Cannot be updated.
          mountPath: /db
        ports:
        - containerPort: 8001 #exposed conainer port and protocol
          protocol: TCP
      volumes:
      - name: db
        emptyDir: {} # node-ephemeral volume https://kubernetes.io/docs/concepts/storage/volumes/#emptydir
</code></pre>
<p><strong>Service:</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: redisinsight-http # name should not be redisinsight 
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 8001
  selector:
    app: redisinsight
</code></pre>
<p>Please note the name of the service.</p>
<p>Logs of redisinsight pod:</p>
<pre><code> INFO 2020-09-02 11:46:20,689 redisinsight_startup Registered SIGTERM handler
 INFO 2020-09-02 11:46:20,689 redisinsight_startup Starting webserver...
 INFO 2020-09-02 11:46:20,689 redisinsight_startup Visit http://0.0.0.0:8001 in your web browser. Press CTRL-C to exit.
</code></pre>
<p>Also the service end point (from minikube):</p>
<pre><code>$ minikube service list                                                                              
|----------------------|------------------------------------|--------------|-------------------------|
|      NAMESPACE       |                NAME                | TARGET PORT  |           URL           |
|----------------------|------------------------------------|--------------|-------------------------|
| default              | kubernetes                         | No node port |
| default              | redisinsight-http                  |           80 | http://172.17.0.2:30860 |
| kube-system          | ingress-nginx-controller-admission | No node port |
| kube-system          | kube-dns                           | No node port |
| kubernetes-dashboard | dashboard-metrics-scraper          | No node port |
| kubernetes-dashboard | kubernetes-dashboard               | No node port |
|----------------------|------------------------------------|--------------|-------------------------|
</code></pre>
<p>BTW, If you don't want to create a service at all (which is not related the question), you can do port forwarding:</p>
<pre><code>kubectl port-forward &lt;redisinsight-pod-name&gt; 8001:8001
</code></pre>
