<p>I have multiple Bazel rules for deploying Kubernetes</p>

<ol>
<li><a href="https://github.com/flolude/cents-ideas/blob/2b47e53c6f8f2b44db09c570fc9873f27b83f9a0/services/ideas/BUILD#L79" rel="nofollow noreferrer">deployments</a>:</li>
</ol>

<pre><code>load("@k8s_deploy//:defaults.bzl", "k8s_deploy")
k8s_object(
  name = "k8s_deployment",
  kind = "deployment",
  cluster = "cents-ideas",
  template = ":ideas.deployment.yaml",
  images = {
    "gcr.io/cents-ideas/ideas:latest": ":image"
  },
)
</code></pre>

<ol start="2">
<li><a href="https://github.com/flolude/cents-ideas/blob/2b47e53c6f8f2b44db09c570fc9873f27b83f9a0/services/ideas/BUILD#L88" rel="nofollow noreferrer">services</a>:</li>
</ol>

<pre><code>k8s_object(
  name = "k8s_service",
  kind = "service",
  template = ":ideas.service.yaml",
)
</code></pre>

<p>And I've put all those <code>k8s_object</code> together into a single <code>k8s_objects</code> like <a href="https://github.com/flolude/cents-ideas/blob/2b47e53c6f8f2b44db09c570fc9873f27b83f9a0/BUILD#L21" rel="nofollow noreferrer">this</a>:</p>

<pre><code>load("@io_bazel_rules_k8s//k8s:objects.bzl", "k8s_objects")
k8s_objects(
    name = "k8s",
    objects = [
      ":k8s_deployment",
      ":k8s_service"
    ]
)
</code></pre>

<p>Lastly, I have a <a href="https://github.com/flolude/cents-ideas/blob/2b47e53c6f8f2b44db09c570fc9873f27b83f9a0/cloudbuild.yaml" rel="nofollow noreferrer"><code>cloudbuild.yaml</code></a> file which runs the <code>k8s_objects</code> rule:</p>

<pre><code>steps:
  - id: 'push docker images and deploy changes to kubernetes'
    name: gcr.io/cloud-builders/bazel
    args: ['run', '//:kubernetes']
</code></pre>

<p>But the Kubernetes resources are not applied to the cluster, although the Cloud Build succeeds:
<a href="https://i.stack.imgur.com/Cb2Dv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cb2Dv.png" alt="cloud build"></a></p>

<p><a href="https://00e9e64bac83fdc66c45609b911427a2f5c2d6ad95f35fb827-apidata.googleusercontent.com/download/storage/v1/b/64811142611.cloudbuild-logs.googleusercontent.com/o/log-5a859279-021b-4b1d-a589-06bce962f6e5.txt?qk=AD5uMEtumX9E_XLDwKbPXDw5MV98lirAnwjMyZgC3cplR0JTjrUOcZwD8kJc8Q5QVuwbVJHLyks3PRMh0uxlHq-TWpkJ5ss25PkEOBAXj5PCtp6amo0Pbxo8KIWyKKlHGec49l_jlHEUGz5Hw8ccWThpFsHzvqjd5JMAStWB60d0eUWHhiAjypyhrnetKHOI1Ibve-PhUuPmcQggp4tRTKmWBb8vjOAdMNaC9Jv-HA0dOXTUqHTaS88iCM56l-51hfzp-aW_ISaltRXrtLQU_gWD6hA9QaC_EGKQ8d9B9BqZoCERO8PwHgWEsM3fF87GTKGWZ2bTiFMVPEiCKBwDhZeX2jtcGeLdM-6aQzKYOAFSUpQ81enMhUJyFxdF-sIpojC4NnyhwDxRPe0MNr0xLWQg9pF0rrKhvBojnAX0fsbxQjTrIaRJS6jBfzwcN5NZJHr6tKK8MXkYvopNfkWaBhkVsvDr5hIr_iKeZ--xgUg9EX98bEPMaOEqRXbIZZDfIopc_qPEi-V1oacadbW5PbjNU_9JbeURqWgUTz6eglHHxcqeTSCXlJxEyanKd4BeKw8QsURzXnfIQlj99Dnq8g7Sye-21PiEVPLEApLMuETbHMBW_uoa3SEbtCNNx3_A0Ix1p5936KliCD57KFzpQkaJGjSI8MDg0eDrJHyVjo-GEdDZKJmVbLnkrez1P_NOJbI73sDWqoytwytx35LN0ypVBtr8KLF_1WQFfmu1F7B4X2sp2m2RGCHReVTvUqys4X76IKAwbWXKBl5-psitqWeAiQLGpZUDKjQGBoj8IwHYZyTNHq2MAAvhY9vByQjSqq1rg7IW5OQGEjftgsj3Oracp1cERLE9xGwHO6X6oM6NfYVJQxDUeRkxeH4f5bFoqMR7mQsaA6Fy" rel="nofollow noreferrer">Here</a> is the full build log.</p>

<p>So basically the images are pushed to the container registry and then the modified <code>.yaml</code> files are logged, but <strong>not</strong> applied to my Google Kubernetes Engine cluster.</p>

<p>I think you need to suffix the target with ".create" or ".replace" see <a href="https://github.com/bazelbuild/rules_k8s#create" rel="nofollow noreferrer">docs</a></p>

<p>So you would want something like:</p>

<pre><code>bazel run //:k8s.create
</code></pre>

<p>where k8s is your target name.</p>
