- How to discover the OpenShift cluster in SWIFT.
- Discover the AWS OpenShift cluster with SWIFT
- First, we need to login to the SWIFT dashboard and navigate to the ‘container cluster’ menu and click on Add button.
- Once you click on the Add button you will appear a screen below and select the ‘cloud type’ from the dropdown menu.
- We support several clouds for OpenShift.
- Friendly name: You need to enter a friendly name according to your cluster or project.
- Cloud Type: Choose the ‘cloud type’ from the dropdown as SWIFT supports various clouds.
- Service Account Token:
- You need to fetch the token from the OpenShift cluster. Before doing this, ensure that the OpenShift cluster is provisioned and available for use.
- Then you need to copy the ‘DNS entries’ from the cluster config and add them to your laptop's host file as well as the Linux host file.
- Now you can access the console for the OpenShift cluster using the OpenShift portal URL (you can use this from the DNS entries themselves).
- Use the username and password available in cluster details. You can login with ‘kubeadmin’ and their ‘password’. It is mentioned in the OpenShift config file.
- After logging in Click on kube:admin button at top right corner and click on Copy login command. There we can find the login command if we wish to access the CLI.
- Install OC CLI if it is not installed on the VM.
- Login using ‘oc login’ CLI.
- Create a Service account token using following CLI, replace ‘pk-test’ with your namespace.
- oc create sa kubeadmin -n pk-test
- Apply role-based access control using following CLI.
- oc apply -f /home/rbac.yaml -n pk-test
----rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: swift-admin-crb
subjects:
- kind: ServiceAccount
name: <sa name>
namespace: <sa namespace>
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
- Describe the service account.
- oc describe sa kubeadmin -n pk-test
- it will print output as below -
Name: kubeadmin
Namespace: default
Labels: <none>
Annotations: <none>
Image pull secrets: kubeadmin dockercfg-qh5lk
Mountable secrets: kubeadmin-dockercfg-qh5lk
Tokens: kubeadmin-token-vbzcd
- Describe above secret token to get the key to be used in cluster discovery.
- oc describe secret kubeadmin-token-vbzcd -n pk-test. It will show the one ‘secret key’ that key need to copy and paste it in ‘Service Account Token’ box in SWIFT.
- Apply cluster role binding using following CLI.
- oc apply -f /home/crb.yaml -n pk-test
---crb.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: swift-admin-crb
subjects:
- kind: ServiceAccount
name: kubeadmin
namespace: pk-test
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
- Port: Provide by-default 6443.
- IP Address/DNS Name: Put the IP address that you saved from the cluster config into the /etc/hosts file.
- Access Key: Provide the Access key of your aws account.
- Region: Select the region where you cluster is provisioned.
- Secret Key: Provide your aws secret key
- TRAIPOD Config, Cluster Private IP Config and Advanced Options: You can refer to the AWS K8S cluster discovery section. We have explained it very well there, as this option is very similar across all clouds.
- Now you can ‘Add’ cluster by pressing add button and AWS OpenShift cluster will be discovered within few seconds.
- Discover the GCP OpenShift cluster with SWIFT
- First, we need to login to the SWIFT dashboard and navigate to the ‘container cluster’ menu and click on ‘Add’ button.
- Once you click on the Add button you will appear a screen below and select the ‘cloud type’ from the dropdown menu.
- Friendly name: You need to enter a friendly name according to your cluster or project.
- Cloud Type: Choose the ‘cloud type’ as a ‘Google GCP’ from the dropdown as SWIFT supports various clouds.
- Service Account Token, Port & IP Address: You can refer to the steps we followed for AWS OpenShift above. Similarly, you can create and provide the token, port, and IP address.
- Region: Choose region from dropdown where your cluster is located.
- Private Key File: Click on the button to browse your local system and select the private key file (e.g., service-account-key.json).
- TRAIPOD Config, Cluster Private IP Config and Advanced Options: You can refer to the AWS K8S cluster discovery section. We have explained it very well there, as this option is very similar across all clouds.
- Now you ‘Add’ cluster by pressing add button and GCP OpenShift cluster will be discovered within few seconds.
- Discover the Azure OpenShift cluster with SWIFT
- First, we need to login to the SWIFT dashboard and navigate to the ‘container cluster’ menu and click on ‘Add’ button.
- Once you click on the Add button you will appear a screen below and select the ‘cloud type’ from the dropdown menu.
- Friendly name: You need to enter a friendly name according to your cluster or project.
- Cloud Type: Choose the cloud type as a ‘Microsoft Azure’ from the dropdown as SWIFT supports various clouds.
- Service Account Token, Port & IP Address: You can refer to the steps we followed for AWS OpenShift above. Similarly, you can create and provide the token, port, and IP address.
- Subscription ID: Put the Subscription ID. This is a unique identifier for your subscription.
- Tenant ID: Put the Tenant ID as this is unique identifier for your Azure AD instance.
- Resource group: Provide resource group as this is a logical container that holds related resources for an Azure solution. It enables you to manage and organize resources such as virtual machines, storage accounts, and virtual networks.
- Client ID: Put the client ID in this section from azure portal. This is a password-like string that is generated when you register an application in Azure AD.
- TraiPOD Config, Cluster Private IP config and Advanced option: This is similar as a K8S clouds, so please refer to the AWS K8S discovery section.
- Then you can click on the ‘Add’ button to discover the OpenShift Azure cluster. It will be discovered in 3-4 seconds
- Discover the IBM OpenShift Container Platform (OCP) cluster with SWIFT
- First, we need to login to the SWIFT dashboard and navigate to the ‘container cluster’ menu and click on ‘Add’ button.
- Once you click on the Add button you will appear a screen below and select the ‘cloud type’ from the dropdown menu.
- Friendly name: You need to enter a friendly name according to your cluster or project.
- Cloud Type: Choose the cloud type as a ‘OCP’ from the dropdown as SWIFT supports various clouds.
- Cluster Name: Provide OCP cluster name.
- API Key: Input directly or browse the IBM API key from the IBM cloud. You can create an API key if isn’t created as below.
- Go to the IBM cloud and Login with your credentials.
- Click on your profile icon in the top right corner and select "Manage API keys".
- Click Create an IBM Cloud API key
- Give your API key a name and description, then click "Create".
- Once created, download the API key file and/or copy the API key. Keep it secure. And upload it in SWIFT while discovering OCP cluster in SWIFT.
- TRAIPOD Config, Cluster Private IP Config and Advanced Options: You can refer to the AWS K8S cluster discovery section. We have explained it very well there, as this option is very similar across all clouds.
- Now you ‘Add’ cluster by pressing add button and OCP cluster will be discovered within few seconds
Discover the IBM OpenShift Container Platform (OCP) cluster with SWIFT
- First, we need to login to the SWIFT dashboard and navigate to the ‘container cluster’ menu and click on ‘Add’ button.
- Once you click on the Add button you will appear a screen below and select the ‘cloud type’ from the dropdown menu.
- Friendly name: You need to enter a friendly name according to your cluster or project.
- Cloud Type: Choose the cloud type as a ‘OKD’ from the dropdown as SWIFT supports various clouds.
- Service Account Token, Port & IP Address: You can refer to the steps we followed for AWS OpenShift above. Similarly, you can create and provide the token, port, and IP address.
- API Key: Input directly or browse the IBM API key from the IBM Cloud. You can create an API key if one hasn’t been created. You can refer to the OCP section above for steps on how to create an API key in the IBM Cloud.
- TRAIPOD Config, Cluster Private IP Config and Advanced Options: You can refer to the AWS K8S cluster discovery section. We have explained it very well there, as this option is very similar across all clouds.
- Now you ‘Add’ cluster by pressing add button and ‘OKD’ cluster will be discovered within few seconds.