Connect Flow to Kubernetes clusters via cloud service authorization or certificate files to enable pipeline deployments.
Connect to a Kubernetes cluster
Flow provides two methods to connect Kubernetes clusters for application deployment:
Custom Kubernetes cluster
-
Obtain the cluster config file
Generate admin config file
To configure fine-grained access control, manually generate the config file:
curl -k https://<YOUR_API_SERVER_PUBLIC_IP>:6443Create a ~/.kube/config file and add the following content:
apiVersion: v1 clusters: - cluster: # needed if you get error "Unable to connect to the server: x509: certificate signed by unknown authority" insecure-skip-tls-verify: true server: https://YOUR_API_SERVER_PUBLIC_IP:6443 name: kubernetes contexts: - context: cluster: kubernetes user: kubernetes-admin name: kubernetes-admin@kubernetes current-context: kubernetes-admin@kubernetes kind: Config preferences: {} users: - name: kubernetes-admin user: client-certificate-data: LS0tLS1CRUdJTi... (base64 /etc/kubernetes/ssl/node-node1.pem) client-key-data: LS0tLS1CRUdJTiBS.. (base64 /etc/kubernetes/ssl/node-node1-key.pem)Generate
client-certificate-data:cat /etc/kubernetes/ssl/node-node1.pem | base64 -w 0Generate
client-key-data:cat /etc/kubernetes/ssl/node-node1-key.pem | base64 -w 0Verify the certificate:
$ kubectl get nodes NAME STATUS AGE VERSION my-kube Ready 2h v1.6.7+coreos.0From the ACK console
In the Alibaba Cloud console, go to . Click Details for the target cluster in the Clusters list and obtain the config file from the Connection Information section.
ImportantTo connect using a certificate file, the cluster's API server must be publicly accessible.
On the Connection Information page, select the public access or internal access tab and click Copy to obtain the kubeconfig.
-
Create the custom cluster connection
Select Custom Cluster, enter a cluster name, add the kubeconfig file, and click Save. Flow uses this file to deploy applications to the cluster.
The dialog box contains a Cluster Name field, an auto-generated Cluster ID field, and a Cluster Configuration File text area (placeholder:
~/.kube/config). -
Manage cluster permissions
Click Modify for the target cluster and select Member Permissions to manage access.
Use the Kubernetes cluster connection
Open the target pipeline, click the Kubernetes Deploy task, and select the cluster from . The pipeline deploys to the selected cluster at runtime. Kubernetes Kubectl Apply.
In the configuration panel, select a cluster (for example, corefile-test) from Cluster Connection and configure Kubectl Version, namespace, and YAML Path.