简体   繁体   English

AWS云提供商上的Kubernetes

[英]Kubernetes on AWS cloud provider

I installed CentOS Atomic Host as operating system for kubernetes on AWS. 我安装了CentOS Atomic Host作为AWS上kubernetes的操作系统。

Everything works fine, but it seems I missed something. 一切都很好,但似乎我错过了一些东西。

I did not configure cloud provider and can not find any documentation on that. 我没有配置云提供商,也找不到任何相关文档。

In this question I want to know: 1. What features cloud provider gives to kubernetes? 在这个问题中,我想知道:1。云提供商为kubernetes提供了哪些功能? 2. How to configure AWS cloud provider? 2.如何配置AWS云提供商?

UPD 1 : external load balancer does not work; UPD 1 :外部负载平衡器不起作用; I have not tested awsElasticBlockStore yet, but I also suspect it does not work. 我还没有测试过awsElasticBlockStore ,但我也怀疑它不起作用。

UPD 2 : Service details: UPD 2 :服务细节:

$ kubectl get svc nginx-service-aws-lb -o yaml
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: 2016-01-02T09:51:40Z
  name: nginx-service-aws-lb
  namespace: default
  resourceVersion: "74153"
  selfLink: /api/v1/namespaces/default/services/nginx-service-aws-lb
  uid: 6c28b718-b136-11e5-9bda-06c2feb29b0d
spec:
  clusterIP: 10.254.172.185
  ports:
  - name: http-proxy-protocol
    nodePort: 31385
    port: 8080
    protocol: TCP
    targetPort: 8080
  - name: https-proxy-protocol
    nodePort: 31370
    port: 8443
    protocol: TCP
    targetPort: 8443
  selector:
    app: nginx
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}

I can't speak to the ProjectAtomic bits, nor to the KUBERNETES_PROVIDER env-var, since my experience has been with the CoreOS provisioner. 我不能说ProjectAtomic位,也不能说KUBERNETES_PROVIDER env-var,因为我的经验是使用CoreOS配置器。 I will talk about my experiences and see if that helps you dig a little more into your setup. 我将谈谈我的经历,看看这是否有助于您进一步深入了解您的设置。

Foremost, it is absolutely essential that the controller EC2 and the worker EC2 machines have the correct IAM role that will enable the machines to make AWS calls on behalf of your account. 最重要的是,控制器EC2和工作人员EC2机器必须具有正确的IAM角色 ,这将使机器能够代表您的帐户进行AWS呼叫。 This includes things like provisioning ELBs and working with EBS Volumes (or attaching an EBS Volume to themselves, in the case of the worker). 这包括配置ELB和使用EBS卷(或者在工作人员的情况下为自己附加EBS卷)之类的事情。 Without that, your cloud-config experience will go nowhere. 没有它,您的云配置体验将无处可去。 I'm pretty sure the IAM payloads are defined somewhere other than those .go files, which are hard to read, but that's the quickest link I had handy to show what's needed. 我很确定IAM有效负载是在除了那些难以阅读的.go文件之外的地方定义的,但这是我用来展示所需内容的最快的链接。

Fortunately, the answer to that question, and the one I'm about to talk about, are both centered around the apiserver and the controller-manager . 幸运的是,这个问题的答案,以及我将要讨论的问题,都围绕着apiservercontroller-manager The configuration of them and the logs they output. 它们的配置和它们输出的日志。

Both the apiserver and the controller-manager have an argument that points to an on-disk cloud configuration file that regrettably isn't documented anywhere except for the source . apiservercontroller-manager都有一个参数指向磁盘上的云配置文件,遗憾的是除了之外没有记录。 That Zone field is, in my experience, optional (just like they say in the comments). 根据我的经验, Zone区域是可选的(就像他们在评论中所说的那样)。 However, it was seeing the KubernetesClusterTag that led me to follow that field around in the code to see what it does. 然而,它看到KubernetesClusterTag导致我在代码中关注该字段以查看它的作用。

If your experience is anything like mine, you'll see in the docker logs of the controller-manager a bunch of error messages about how it created the ELB but could not find any subnets to attach to it; 如果您的体验与我的相似,您会在controller-manager的docker日志中看到一堆关于它如何创建ELB但无法找到附加到其上的子网的错误消息; (that "docker logs" bit is presuming, of course, that ProjectAtomic also uses docker to run the Kubernetes daemons). (当然,“docker logs”位假定ProjectAtomic也使用docker来运行Kubernetes守护进程)。

Once I attached a Tag named KubernetesCluster and set every instance of the Tag to the same string (it can be anything, AFAIK), then the aws_loadbalancer was able to find the subnet in the VPC and it attached the Nodes to the ELB and everything was cool -- except for the part about it can only create Internet facing ELBs, right now. 一旦接上一个Tag名为KubernetesCluster和设置的每个实例Tag相同的字符串(它可以是任何东西,据我所知),则aws_loadbalancer能够找到在VPC子网,它连接的节点到ELB,一切都酷 - 除了关于它的部分,现在只能创建面向互联网的 ELB。 :-( :-(

Just for clarity: the aws.cfg contains a field named KubernetesClusterTag that allows you to redefine the Tag that Kubernetes will look for; 为了清楚起见: aws.cfg包含一个名为KubernetesClusterTag的字段,允许您重新定义 Kubernetes将要查找的Tag ; without any value in that file, Kuberenetes will use the Tag name KubernetesCluster . 在该文件中没有任何价值,Kuberenetes将使用Tag名称KubernetesCluster

I hope this helps you and I hope it helps others, because once Kubernetes is up, it's absolutely amazing. 我希望这对你有所帮助,我希望它可以帮助别人,因为一旦Kubernetes上场,这绝对是惊人的。

  1. What features cloud provider gives to kubernetes? 云提供商为kubernetes提供了哪些功能?

Some features that I know: the external loadbalancer , the persistent volumes . 我知道的一些功能: 外部负载均衡器持久性卷

  1. How to configure AWS cloud provider? 如何配置AWS云提供商?

There is a environment var called KUBERNETES_PROVIDER , but it seems the env var only matters when people start a k8s cluster. 有一个名为KUBERNETES_PROVIDER的环境KUBERNETES_PROVIDER ,但似乎env var仅在人们启动k8s集群时才有意义。 Since you said "everything works fine", I guess you don't need any further configuration to use the features I mentioned above. 既然你说“一切正常”,我你不需要任何进一步的配置来使用我上面提到的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM