There is an open issue to add a Bazel sample since 2020 and not much else in the docs regarding Bazel.
I’ve configured a Bazel k8s_object rule that deploys a Helm chart and Go image to a local cluster but not sure how to adapt it to Okteto which seems to rely on having a Dockerfile present (instead of Bazel generating it).
Okteto uses a file called okteto.yaml in the root of the repo to tell Okteto how to build an deploy your development environment. You should be able to run the required bazel commands from there, a long as they are namespace-scoped:
We’re trying to migrate to Bazel for a variety of reasons including faster build times. The command is:
bazel run :k8s_okteto.apply
but when it runs directly or via Okteto it gives an auth error:
Unable to publish images: unable to push image registry.cloud.okteto.net/myuser/service:latest: GET https://cloud.okteto.com/auth/registry?scope=XXX:
unexpected status code 401 Unauthorized
What is bazel using underneath to build the container image? Based on the error, it seems like you need need to authenticate with the Okteto registry before pushing the image.
If you are using the docker daemon to build the image, you can do it by running something like: