问题
I am trying to setup Kubernetes on AWS EC2 there are writeups from this website which is wonderful
https://itnext.io/kubernetes-part-2-a-cluster-set-up-on-aws-with-aws-cloud-provider-and-aws-loadbalancer-f02c3509f2c2
I used the following config file for "kubeadm init"
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
apiServer:
extraArgs:
cloud-provider: "aws"
controllerManager:
extraArgs:
cloud-provider: "aws"
I got an error message saying that aws has been depreciated
I used the same file with the cloud-provider changed to "openstack"
Still I am getting errors; looks like the new version of Kubernetes I need to use another parameter "cloud-config" which has the configuration
Can anyone help me on how this needs to be done and how I can successfully configure a k8 cluster using EC2.
回答1:
Referring from here You can use below config for AWS.
apiVersion: kubeadm.k8s.io/v1beta2
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
cloud-provider: "openstack"
cloud-config: "/etc/kubernetes/cloud.conf"
---
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
kubernetesVersion: v1.13.0
apiServer:
extraArgs:
cloud-provider: "openstack"
cloud-config: "/etc/kubernetes/cloud.conf"
extraVolumes:
- name: cloud
hostPath: "/etc/kubernetes/cloud.conf"
mountPath: "/etc/kubernetes/cloud.conf"
controllerManager:
extraArgs:
cloud-provider: "openstack"
cloud-config: "/etc/kubernetes/cloud.conf"
extraVolumes:
- name: cloud
hostPath: "/etc/kubernetes/cloud.conf"
mountPath: "/etc/kubernetes/cloud.conf
And then you can do kubeadm init --config=kubeadm-config.yml
https://kubernetes.io/blog/2020/02/07/deploying-external-openstack-cloud-provider-with-kubeadm/
You could avoid all of these if you just used Kops to install kubernetes on AWS.
来源:https://stackoverflow.com/questions/61270878/setup-kubernetes-version-1-18-cluster-on-aws-ec2