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
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • GitOps: Flux vs Argo CD
  • Kafka on Kubernetes, the Strimzi Way (Part 2)
  • 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

  • DZone's Article Submission Guidelines
  • The End of “Good Enough Agile”
  • Event Driven Architecture (EDA) - Optimizer or Complicator
  • Rust, WASM, and Edge: Next-Level Performance
  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 user avatar
Sai Sandeep Ogety
DZone Core CORE ·
Nov. 27, 24 · Tutorial
Likes (27)
Comment
Save
Tweet
Share
1.5K Views

Join the DZone community and get the full member experience.

Join For Free

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
  • Kafka on Kubernetes, the Strimzi Way (Part 2)
  • 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
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!