At CenterEdge Software , we currently operate our Kubernetes clusters on AWS . We manage the clusters ourselves, using the kops tool. Unfortunately, managing your own Kubernetes cluster adds a lot of overhead.

Therefore, I recently embarked on a proof of concept using Amazon Elastic Container Service for Kubernetes , a.k.a. EKS. I quickly found that a significant friction point in this process was my windows 10 laptop, which is a problem since CenterEdge Software is a Microsoft shop.

Below I share some of the steps I found that helped along the way. I won’t cover setting up the EKS cluster itself, I’ll let the AWS documentation handle that.

Prerequisites

Install kubectl and the AWS CLI . I used Chocolatey to install both.

choco install -y kubernetes-cli choco install -y aws-cli

Configure AWS CLI with your credentials

aws configure Setting Up AWS IAM Authenticator

When using EKS, kubectl must be configured to use the https://github.com/kubernetes-sigs/aws-iam-authenticator . This lightweight utility is called by kubectl to get authentication tokens, and uses your credentials configured for the AWS CLI. It can support IAM roles and multiple profiles, but for this example I’ll keep it simple and assume we’re using the default profile configured via aws configure .

Download the authenticator. The current URL for Windows is https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/windows/amd64/aws-iam-authenticator.exe, but you may want to find the up-to-date version here . Place aws-iam-authenticator.exe somewhere in your system path. For example, I was lazy and put it in C:\ProgramData\Chocolatey\bin. Right-click on aws-iam-authenticator.exe, select Properties, and Unblock the file so it can be executed.

Confirm that the command is working from a new shell window:

aws-iam-authenticator --help Adding Your Cluster To Your Kubernetes Config

The easiest way to add your cluster to your Kubernetes configuration is using the AWS CLI. It’s also possible to keep multiple configuration files, but I prefer having multiple contexts inside my default configuration file.

# Substitute "brant" below with the name of your EKS cluster aws eks update-kubeconfig --name brant

However, after this is complete I recommend changing the name of the created context to be more usable. The first parameter below is the name of the context output by the update-kubeconfig command. The second is the new name.

kubectl config rename-context arn:aws:eks:us-east-1:000000000000:cluster/brant brant

Finally, test it out!

kubectl get svc Working From Ubuntu on Windows using WSL

Unfortunately, many tools you may wish to use are linux tools and don’t work well from Windows. An easy solution is to install Ubuntu on Windows 10 . However, making your previous configuration for EKS work in Ubuntu requires a few more steps.

Install [kubectl]https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-using-native-package-management) in Ubuntu.

Add a KUBECONFIG environment variable to your Windows user profile (alter the path below if needed):

setx KUBECONFIG ${env:USERPROFILE}\.kube\config

Configure WSL to pass KUBECONFIG into Ubuntu, while remapping the path :

# WSLENV is a colon-separated list of environment variables to copy to Ubuntu from your Windows Profile # Appending "/p" to the variable name tells WSL that the variable is a path, and to remap the path to the Ubuntu path when it's copied setx WSLENV $($(if ([System.String]::IsNullOrWhitespace(${env:WSLENV})) { "" } else { ${env:WSLENV} + ":"}) + "KUBECONFIG/p") Restart Ubuntu

Test it out. Kubectl will run in Ubuntu, which in turn executes the Windows aws-iam-authenticator.exe process to get the authentication token.

kubectl get svc Conclusion

At this point, you should have complete access to your EKS cluster via kubectl from both Powershell and Ubuntu Bash. Now the real fun can begin!

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

代码区博客精选文章
分页:12
转载请注明
本文标题:Using Amazon Elastic Container Service for Kubernetes (EKS) on Windows 10
本站链接:https://www.codesec.net/view/611440.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(60)