<p>I'm trying to publish to an existing pubsub topic from a Scala application running in Google Container Engine (i.e. running in Kubernetes). </p>

<p>I have enabled (I think) the correct permissions for the underlying cluster: </p>

<p><a href="https://i.stack.imgur.com/WnEwS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WnEwS.png" alt="permissions"></a></p>

<p>However, when I try run my Scala application, I get the following error: </p>

<pre><code>2016-12-10T22:22:57.811982246Z Caused by:
com.google.cloud.pubsub.PubSubException: java.lang.IllegalStateException: 
No NameResolverProviders found via ServiceLoader, including for DNS. 
This is probably due to a broken build. If using ProGuard, check your configuration
</code></pre>

<p>Full stack trace <a href="https://gist.github.com/ciaranarcher/58fa789c2f4ffe5d15f902bff7233295" rel="noreferrer">here</a>.</p>

<p>My Scala code is pretty much right out of the quick start guide: </p>

<pre><code>val TopicName = "my-topic"
val pubsub = PubSubOptions.getDefaultInstance.getService
val topic = pubsub.getTopic(TopicName)
...
topic.publish(Message.of(json))
</code></pre>

<p>I think I might be missing some vital Kubernetes configuration, so any and all help is very much appreciated.</p>

<p>I've found that this problem happens when sbt manages the "com-google-cloud-pubsub" dependancy. My work around to this is, I created a maven project and built a jar with only that dependency. Then I added that jar to my classpath and in my build.sbt I annotated the "com-google-cloud-pubsub" as "provided". I hope this works for you. </p>

<pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;com.google.cloud&lt;/groupId&gt;
        &lt;artifactId&gt;google-cloud-pubsub&lt;/artifactId&gt;
        &lt;version&gt;0.8.0&lt;/version&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.0.0&lt;/version&gt;
            &lt;configuration&gt;
                &lt;descriptorRefs&gt;
                    &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                &lt;/descriptorRefs&gt;
            &lt;/configuration&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;id&gt;assemble-all&lt;/id&gt;
                    &lt;phase&gt;package&lt;/phase&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;single&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</code></pre>
