DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • GitOps: Flux vs Argo CD
  • Node and Capacity Spillover: What Happens When Kubernetes Runs Out of Room
  • Can You Run a MariaDB Cluster on a $150 Kubernetes Lab? I Gave It a Shot
  • How Kubernetes Cluster Sizing Affects Performance and Cost Efficiency in Cloud Deployments

Trending

  • Member Spotlight: Srinivas Chippagiri
  • Time to First Token: How Long Does It Take for a Large Model to Start Responding?
  • Avoiding AI Debt as a Team
  • Running an OpenStreetMap Tile Server for the Whole Planet on Modest Hardware

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. Kconnect: Simplifying Kubernetes Connectivity With a Powerful CLI

Kconnect: Simplifying Kubernetes Connectivity With a Powerful CLI

Kconnect is a simple CLI tool that quickly connects to Kubernetes clusters like EKS, AKS, and RKS, saving time by generating kubeconfig files instantly.

By 
Sai Sandeep Ogety
DZone Core CORE ·
Nov. 27, 24 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
2.7K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Let's assume that if you want to connect to a Kubernetes cluster with multiple CSPs (EKS/AKS/RKS), you have to use respective CLI to generate kubeconfig and use kubectl commands. What if I say there is a better way for Cloud/Platform/DevOps and SRE Engineers to connect to clusters using kconnect?

What Is kconnect?

kconnect is a Command-Line Interface (CLI) utility that can be used to discover and securely access Kubernetes clusters across multiple operating environments.

Based on the authentication mechanism chosen, the CLI will discover Kubernetes clusters you are allowed to access in a target hosting environment and generate a kubeconfig for a chosen cluster. Currently, kconnect supports the following platforms: EKS, AKS, and Rancher.

Resolution

Using kconnect, you can easily connect to multiple clusters and multiple regions seamlessly. This is a powerful tool for any troubleshooting, automating workloads like routine tasks, generating reports, etc. Below are some features, and we will go through detailed steps on how to use kconnect.

Features

  • Authenticate using SAML, Azure Active Directory, AWS IAM, and Rancher Token.
  • Discover clusters in EKS, AKS, and Rancher.
  • Generate a kubeconfig for a cluster.
  • Query history of connected servers.
  • Regenerate the kubeconfig from your history by using an ID or an alias.

Prerequisites

Before getting started, we need to have below dependencies for EKS and AKS:

  • aws-iam-authenticator
  • kubelogin

Installation

MacOS/Linux

The latest release contains the binaries here.

Alternatively, you can use the command below:

Shell
 
brew install fidelity/tap/kconnect


Windows

The latest release contains the binaries here.

Install the Binaries in One Go

Use the command below to install the binaries, i.e., kubectl, helm and aws-iam-authenticator:

Shell
 
curl -fsSL -o install-kconnect.sh https://raw.githubusercontent.com/fidelity/kconnect/main/scripts/install-kconnect.sh
chmod 700 install-kconnect.sh
./install-kconnect.sh


Connecting to EKS Using Kconnect

Use the commands below to connect to the EKS cluster and authenticate to the cluster:

Shell
 
sh-3.2# kconnect use eks --idp-protocol saml
info	kconnect - the Kubernetes Connection Manager CLI	{"version": "0.5.18"}
info	authenticating user	{"app": "kconnect", "provider": "saml"}
? Select your identity provider ADFS
? Enter the endpoint for the IdP https://enteryouridpendpoint.yourcompanydomain.com
? Select an AWS region us-east-1
? Username: sogety
? Password: **************


sh-3.2# kubectl get pods -A
NAMESPACE     NAME                                 READY   STATUS    RESTARTS   AGE
kube-system   aws-node-5rjcg                       2/2     Running   0          46m
kube-system   aws-node-jglpd                       2/2     Running   0          46m
kube-system   aws-node-jtcm6                       2/2     Running   0          46m
kube-system   coredns-6556f9967c-spmcl             1/1     Running   0          50m
kube-system   coredns-6556f9967c-xhkjg             1/1     Running   0          50m
kube-system   ebs-csi-controller-8df7f678f-4zg2w   6/6     Running   0          46m
kube-system   ebs-csi-controller-8df7f678f-65h7n   6/6     Running   0          46m
kube-system   ebs-csi-node-422fg                   3/3     Running   0          46m
kube-system   ebs-csi-node-khwwq                   3/3     Running   0          46m
kube-system   ebs-csi-node-vtxkn                   3/3     Running   0          46m
kube-system   kube-proxy-6kcgr                     1/1     Running   0          46m
kube-system   kube-proxy-qk7gj                     1/1     Running   0          46m
kube-system   kube-proxy-r8f9p                     1/1     Running   0          46m


Connecting to AKS Using Kconnect

Use the commands below to connect to the AKS cluster and authenticate to the cluster:

Shell
 
sh-3.2# kconnect use aks --idp-protocol aad
info	kconnect - the Kubernetes Connection Manager CLI	{"version": "0.5.18"}
info	authenticating user	{"app": "kconnect", "provider": "aad"}
? Username: sogety
? Password: **************
? Enter the Azure tenant ID **************
? Enter the Azure client ID **************
? Enter the Azure client secret **************


sh-3.2# kubectl get pods -A


Connecting to RKS Using Kconnect

Use the commands below to connect to the RKS cluster and authenticate to the cluster:

Shell
 
sh-3.2# kconnect use rancher
info	kconnect - the Kubernetes Connection Manager CLI	{"version": "0.5.18"}
info	using static token for authentication	{"app": "kconnect", "provider": "static-token"}
? Enter authentication token **************
? Enter the Rancher API endpoint **************
info	discovering clusters	{"app": "kconnect", "provider": "rancher"}
info	discovering clusters via Rancher	{"app": "kconnect", "provider": "rancher"}


sh-3.2# kubectl get pods -A


Conclusion

Authenticating multiple Kubernetes clusters across EKS, AKS, and RKS can be challenging, especially for platform engineers, DevOps teams, and SREs. This tool streamlines the process by generating kubeconfig files on the fly, saving valuable time and effort. It’s particularly useful for automating workflows and managing clusters across different regions and environments. Based on my experience with EKS, AKS, and RKS, this approach has greatly simplified cluster authentication and improved efficiency across platforms.

Command-line interface Kubernetes cluster

Opinions expressed by DZone contributors are their own.

Related

  • GitOps: Flux vs Argo CD
  • Node and Capacity Spillover: What Happens When Kubernetes Runs Out of Room
  • Can You Run a MariaDB Cluster on a $150 Kubernetes Lab? I Gave It a Shot
  • How Kubernetes Cluster Sizing Affects Performance and Cost Efficiency in Cloud Deployments

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook