<p>I am trying to fully automate the deployment to my Kubernetes Cluster with Bazel and <a href="https://github.com/bazelbuild/rules_k8s" rel="nofollow noreferrer">rules_k8s</a>.
But I don't know how to apply external configurations to my cluster.
Usually I would run a command like</p>

<pre><code>kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v0.12.0/cert-manager.yaml
</code></pre>

<p>But I want this to happen automatically when I run my</p>

<pre><code>k8s_objects(
    name = "kubernetes_deployment",
    objects = [
        "//kubernetes:nginx",
        "//services/gateway:k8s",
        "//services/ideas:k8s",
        # ...
    ]
)
</code></pre>

<p>rule to deploy everything to Kubernetes.</p>

<p>try this in your BUILD file, I'm not sure its the best way as it will be re-ran on every build. It would be nice if we could use an  <a href="https://docs.bazel.build/versions/master/repo/http.html#http_file" rel="nofollow noreferrer">http_file</a> here instead of a genrule. </p>

<pre><code>genrule(
        name = "extyaml",
        srcs = [],
        outs = ["certman-k8s.yaml"],
        cmd = "curl -L https://github.com/jetstack/cert-manager/releases/download/v0.12.0/cert-manager.yaml &gt; $@",
    )


    k8s_object(
        name = "certman",
        cluster = "minikube",
        template = ":certman-k8s.yaml",
    )
</code></pre>
