Deploy Application In Remote Cluster via Token
This section enables the creation of the necessary resources to configure access to a remote cluster using a static token.
Using Kubernetes RBAC​
To configure application deployment in remote cluster using Kubernetes RBAC, follow the steps below:
-
Create a ServiceAccount:
apiVersion: v1kind: ServiceAccountmetadata:name: krci-deployernamespace: <deploy_namespace> -
Bind the ServiceAccount to the cluster-admin role using ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata:name: krci-deployer-cluster-admin-bindingsubjects:- kind: ServiceAccountname: krci-deployernamespace: <deploy_namespace>roleRef:kind: ClusterRolename: cluster-adminapiGroup: rbac.authorization.k8s.io -
Create a Secret with a token for the ServiceAccount
apiVersion: v1kind: Secretmetadata:name: krci-deployernamespace: <deploy_namespace>annotations:kubernetes.io/service-account.name: krci-deployertype: kubernetes.io/service-account-token
Using Capsule​
To configure application deployment in remote cluster using the Capsule tool, follow the steps below:
-
Create a ServiceAccount for deployment
apiVersion: v1kind: ServiceAccountmetadata:name: krci-deployernamespace: <deploy_namespace> -
Create a Secret with a token for the ServiceAccount
apiVersion: v1kind: Secretmetadata:name: krci-deployernamespace: <deploy_namespace>annotations:kubernetes.io/service-account.name: krci-deployertype: kubernetes.io/service-account-token -
Configure Capsule to recognize the ServiceAccount’s group
apiVersion: capsule.clastix.io/v1beta2kind: CapsuleConfigurationmetadata:name: defaultspec:userGroups:- capsule.clastix.io- system:serviceaccounts:<deploy_namespace> -
Create a Tenant and assign ownership to the ServiceAccount through Capsule
apiVersion: capsule.clastix.io/v1beta2kind: Tenantmetadata:name: krci-deployernamespace: <deploy_namespace>spec:owners:- clusterRoles:- admin- capsule-namespace-deleterkind: ServiceAccountname: system:serviceaccount:<deploy_namespace>:krci-deployer
Get Kubernetes Token​
To obtain the token generated by following this documentation, run the command below:
kubectl get secret -n <deploy_namespace> krci-deployer -o jsonpath='{.data.token}' | base64 -d
Next Steps​
By completing all the steps in this documentation, you will obtain a token for integration with the Kubernetes cluster. The next step is to configure the cluster integration with KubeRocketCI, as described in the documentation Add Cluster.