How to fix connection being refused from GKE when deployed a shiny app using docker

3/26/2019

I am very new to cloud platform and docker and I am trying to run a shiny app on Google Kubernetes Engine however when I try to access my application I get the error connection refused on the webpage.

As per the article https://code.markedmondson.me/r-on-kubernetes-serverless-shiny-r-apis-and-scheduled-scripts/ I have created a docker image for my app, pushed it to the container registry and deployed on Kubernetes engine using the above article.

However I am not able to identify where am I going wrong. I followed the below article as well however could not fix the issue.

Dockerizing shiny-app using a Dockerfile

Below is the docker file that I used to build my image.

FROM r-base:3.4.2

# install R package dependencies
RUN apt-get update && apt-get install -y \
    ##### ADD YOUR DEPENDENCIES
    ## clean up
    && apt-get clean \ 
    && rm -rf /var/lib/apt/lists/ \ 
    && rm -rf /tmp/downloaded_packages/ /tmp/*.rds

# Install dependencies of app
RUN R -e "install.packages(c('shiny', 'rmarkdown','dplyr','ggplot2','shinydashboard'), repos='http://cran.rstudio.com/')"

# copy the app to the image
COPY app.R /srv/shiny-server/app.R

EXPOSE 8080

CMD ["/usr/bin/shiny-server.sh"]

Below is the yml file

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: r-ingress-nginx
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: / 
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /wordcloud/
      # app deployed to /wordcloud/
        backend:
          serviceName: shiny
          servicePort: 8080

Please can someone help to identifying where am I going wrong and please help to resolve this.

Thanks a lot in advance!!

-- AnalyticsTeam
docker
dockerfile
google-kubernetes-engine
kubernetes
shinydashboard

0 Answers