ShinyProxy on Kubernetes and nfs volume NAS mounts

We tried to use ShinyProxy app on Kubernetes Cluster. But in application.yml file, how to provide mount options? Like how we provide in manifest, we dont have options for volume type, host-path, host-server, etc details. Since pods are spinning in different different nodes of cluster, we need to mount NAS folder on each pod. More over if we use container-volumes: [ /data:/data] its giving error: forbidden, host file system cannot be accessed. Ideally we want to provide NAS mounted paths. So please suggest, how to mount NAS using application.yml file on kubernetes cluster.

Hi @js19841,

This is currently not supported, but will soon be in the next release where you will be able to insert Kubernetes pod patches into the application.yml.

Kind regards,
Tobias

1 Like

HI @js19841

In order to not have to implement every Kubernetes feature in ContainerProxy, we decided to add a generic way of adding Kubernetes specific configuration to a ContainerProxy app. This feature is called kubernetes-pod-patches and allows to patch the specification of the Pod before it is created by ContainerProxy.
More information about this feature can be found here (you have to scroll down a bit).
This should cover your use-case. Feel free to open an issue if you experience any issue with this feature.
The change is included in the just ShinyProxy 2.4.0

Again thanks for your contribution.

Thanks for new version. You released earlier than you committed, highly appreciated.

  1. But I just ran app without any adding any new features, new pod is spinned by kubernetes, application started execution, libraries are loaded, Listening on http://0.0.0.0:3838, But while executing further logic, (we have another login page) entering into app,
    its failing with XNIO001007 A channel even threw an exception java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer …
    (Older version did not give any error)

  2. I included new feature kubernetes-pod-patches to application.yml file.
    included in application spec section (I guessed volumes, mounts are at each application level).
    specs:
    -id : App1
    display-name: xyz
    description: xyz
    ---- other stuff about image, memory&cpu request, limits, access groups of LDAP etc –
    kubernetes-pod-paches: |
    - op: add
    path: /spec/volumes/0
    value:
    name: nfsvol
    nfs:
    server: xyz
    path: xyz

When I ran this config, While spinning pod its giving error:-
The JSON Object '{“conatiners”: … … …} contains no mapping for the name ‘volumes’

Kindly help if you suspect any issue here or if my understanding is wrong on new feature.

Regards
js19841

Hi

Relating the first issue:

We are aware of this error. This error happens when you try to run ShinyProxy 2.4.0 using JDK 8. We changed some pieces in our build infrastructure, since then our JARs are build using OpenJDK 11, therefore they don’t run on JDK 8.

If possible you can choose to use OpenJDK 11 to run ShinyProxy.

However, we plan to build again using OpenJDK 8 for the 2.4.1 release (which we should release soon).

Relating your second issue:

So your problem is that currently the specification of the generated Pod does not contains any volumes, therefore you cannot simply add an extra volume (because the array does not exist).
The following code should work:

specs:
 - id : App1
   display-name: xyz
   description: xyz
   ---- other stuff about image, memory&cpu request, limits, access groups of LDAP etc –  
   kubernetes-pod-paches: |
     - op: add
       path: /spec/volumes
      value: 
         - name: nfsvol
           nfs: 
              server: xyz
              path: xyz

Using this code you create an Array at path /spec/volumes with one item.

As an extra note, you can set the proxy.kubernetes.debug-patches configuration to true in your application.yml.
Then the generated specification for the pod will be printed to the log before and after applying the pod.
This way it is easier to find out what paths do/don’t exist in the generated pod.
See: https://shinyproxy.io/documentation/configuration/#kubernetes

I’ll also updated our example patches, to be more correct.

Hi, Thanks for reply.
Even I tried by removing “/0” at end for both volumes and volumeMounts. Now it is giving different error, which is mentioned below:-

Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of ‘java.util.ArrayList’ out of START_OBJECT token at [Source:UNKNOWN; line: -1, column: -1](through reference chain: io.fabric8.kubernetes.api.model.Pod[“spec”]->io.fabric8.kubernetes.api.model.PodSpec[“containers”]->java.util.ArrayList[0]->io.fabric8.kubernetes.api.model.Container[“volumeMounts”]

So if this error is due to Java Version, then I will try again when new release comes ( as we cannot install JDK 11, because other services will impact )

Hi

We just released [https://shinyproxy.io/downloads/#241](ShinyProxy 2.4.1) which is now again built using JDK 8.

Regarding your other issue. Did you make sure that there is a dash (-) before in your volumeMounts patch? See this image:
Selection_029

This very important and I believe this is currently missing in your patch.

Thanks for New Release. Still we see Java Exceptions in 2.4.1.

  1. By adding hyphen ( - ) as you suggested before name, it solved the issue. Now I can see mounts created at pod volumes. I have seen by executing pod, mounts are there. So this issue is solved. Thanks for this fix. But it is taking little time to up the pod (this may be due to multiple reasons at our end network speed and Image size etc (image need to be pulled from other repository, size is about 4GB)).

  2. Even for 2.4.1 on JDK 8, still we see Java Exceptions. Initially container is Unresponsive (50/50 attempts also its failing to up and throwing exception).
    Some times it is running fine at 4/50 , 5/50 app is up and able to see on browser. But next part of logic is not executing as expected.
    I can see application execution started without errors, Listening on [http://0.0.0.0:3838]. But UI part of app when we click any options on app,
    I can see its failing with XNIO001007 A channel even threw an exception java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer …

Kindly suggest.