# How can I access a global preview environment with "kubectl"?

**URL:** <https://community.okteto.com/t/how-can-i-access-a-global-preview-environment-with-kubectl/1170>\
**Category:** How Do I?\
**Created:** [December 21, 2023, 11:35am UTC](https://community.okteto.com/t/how-can-i-access-a-global-preview-environment-with-kubectl/1170 "2023-12-21T11:35:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pchico83](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/pchico83/32/25_2.png) [@pchico83](https://community.okteto.com/u/pchico83)\
**Post date:** [December 21, 2023, 11:35am UTC](https://community.okteto.com/t/how-can-i-access-a-global-preview-environment-with-kubectl/1170/1 "2023-12-21T11:35:50Z")

</div>

I have access to global preview environments from the Okteto UI, but I get a permission error when using the Okteto CLI or “kubectl” against a global preview environment.  
How can I fix this?

---

<div class="post-metadata">

**Author:** ![pchico83](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/pchico83/32/25_2.png) [@pchico83](https://community.okteto.com/u/pchico83)\
**Post date:** [December 21, 2023, 11:40am UTC](https://community.okteto.com/t/how-can-i-access-a-global-preview-environment-with-kubectl/1170/2 "2023-12-21T11:40:39Z")

</div>

This is not possible with the default Okteto installation. We are working on a feature to fix it, but in the meantime, you can use a [globalClusterRole](https://www.okteto.com/docs/reference/helm-chart-values/#globalclusterrole) to assign this cluster role to every Okteto user via a cluster role binding.

For example, you can use the default `view` cluster role in the `globalClusterRole` field:

```auto
globalClusterRole: view

```

This way, every Okteto user will have read access to all the okteto namespaces. You can also create your own cluster role with custom permissions arefer to it in the `globalClusterRole` field. The limitation is that users will have read access to all the namespaces, not just global previews. We are working on a feature to solve this limitation.
