Skip to content

Commit

Permalink
Merge pull request #104 from mpluhar/master
Browse files Browse the repository at this point in the history
Adding documentation for rke set up and other documentation updates
  • Loading branch information
k8s-ci-robot committed Feb 27, 2020
2 parents 11d182b + af9d4d6 commit 7c67f42
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cloud-controller-manager/instances.go
Expand Up @@ -203,7 +203,7 @@ func (s *InstanceClient) findInstanceByProviderID(providerID string) (*ecs.Insta
return nil, cloudprovider.InstanceNotFound
}
if len(ins) > 1 {
glog.Warningf("alicloud: multipul instance found by nodename=[%s], "+
glog.Warningf("alicloud: multiple instances found by nodename=[%s], "+
"the first one will be used, instanceid=[%s]\n", string(nodeid), ins[0].InstanceId)
}
return &ins[0], nil
Expand Down
84 changes: 76 additions & 8 deletions docs/getting-started.md
Expand Up @@ -4,16 +4,16 @@
- CloudNetwork: Only Alibaba Cloud VPC network is supported.


## Deploy out-of-tree CloudProvider in Alibaba Cloud.
## Deploy CloudProvider in Alibaba Cloud

### Set up a latest supported Kubernetes Cluster of version v1.10+ with Kubeadm.
### Set up a supported Kubernetes Cluster using kubeadm

Kubeadm is an official installation tool for kubernetes. You could bring up a single master kubernetes cluster by following the instruction in this [page](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/).
kubeadm is an official installation tool for kubernetes. You could bring up a single master kubernetes cluster by following the instruction in this [page](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/).

1. Install Docker or other CRI runtime: https://kubernetes.io/docs/setup/cri/
2. Install kubeadm, kubelet and kubectl: https://kubernetes.io/docs/setup/independent/install-kubeadm/
3. Update kubelet info with provider id info and restart kubelet: You should provide ```--hostname-override=${REGION_ID}.${INSTANCE_ID} --provider-id=${REGION_ID}.${INSTANCE_ID}``` arguments in all of your kubelet unit file. The format is ```${REGION_ID}.${INSTANCE_ID}```. See [kubelet.service](examples/kubelet.service) for more details.
4. Init kubeadm: Be advised that kubeadm accept a serious of certain parameters to customize your cluster with kubeadm.conf file. If you want to use your own secure ETCD cluster or image repository, you may find the template [kubeadm.conf](examples/kubeadm.conf) or [kubeadm-new.conf for k8s 1.12+](examples/kubeadm-new.conf) is useful.
4. Init kubeadm: Be advised that kubeadm accepts a number of certain parameters to customize your cluster with kubeadm.conf file. If you want to use your own secure ETCD cluster or image repository, you may find the template [kubeadm.conf](examples/kubeadm.conf) or [kubeadm-new.conf for k8s 1.12+](examples/kubeadm-new.conf) is useful.

Run the command below to initialize a kubernetes cluster.
```$bash
Expand All @@ -29,22 +29,90 @@ $ META_EP=http://100.100.100.200/latest/meta-data
$ echo `curl -s $META_EP/region-id`.`curl -s $META_EP/instance-id`
```

### Set up a supported Kubernetes Cluster using rke

For now, you should have a running kubernetes cluster. Try some example command like ```kubectl get no ```
Rancher Kubernetes Engine [rke](https://github.com/rancher/rke) is another Kubernetes installer.

1. Provision the nodes for your cluster in Alicloud
2. Set up cluster.yml file for deploying the Kubernetes cluster. Make sure to provide hostname_override parameters and insert the hostnames of the cluster nodes using the region-id.instance-id format

```
nodes:
- address: nnn.nnn.nnn.nnn
user: root
role:
- controlplane
- etcd
ssh_key_path: ~/ssh.pem
internal_address: 172.16.1.29
hostname_override: "cn-hangzhou.i-bp18j8zzajt93rztiw9g" <- override hostname
- address: nnn.nnn.nnn.nnn
user: root
role:
- worker
ssh_key_path: ~/ssh.pem
internal_address: 172.16.1.19
hostname_override: "cn-hangzhou.i-bp109r2aiuf935xxi4po" <- override hostname
labels:
rke.cattle.io/external: nnn.nnn.nnn.nnn
- address: nnn.nnn.nnn.nnn
user: root
role:
- worker
ssh_key_path: ~/ssh.pem
internal_address: 172.16.1.21
hostname_override: "cn-hangzhou.i-bp16uimj7fl6ze8q5rf3" <- override hostname
labels:
rke.cattle.io/external: nnn.nnn.nnn.nnn
addon_job_timeout: 90
services:
kubelet:
extra_args:
node-status-update-frequency: 4s
volume-plugin-dir: /usr/libexec/kubernetes/kubelet-plugins/volume/exec
extra_binds:
- /usr/libexec/kubernetes/kubelet-plugins/volume/exec:/usr/libexec/kubernetes/kubelet-plugins/volume/exec
kube-api:
service_node_port_range: 10000-12500
extra_args:
default-not-ready-toleration-seconds: 30
default-unreachable-toleration-seconds: 30
kube-controller:
extra_args:
node-monitor-period: 2s
node-monitor-grace-period: 16s
pod-eviction-timeout: 30s
addon_job_timeout: 90
```

3. Provision the cluster using rke

4. Currently rke does not support setting the providerID as a configuration option.
Once the cluster has been provisioned update the nodes and make sure providerID is set to REGION.NODEID

```
kubectl patch node ${NODE_NAME} -p "{\"spec\":{\"providerID\": ${NODE_NAME} }}"
```
For example
```
kubectl patch node cn-hangzhou.i-bp16uimj7fl6ze8q5rf3 -p "{\"spec\":{\"providerID\": cn-hangzhou.i-bp16uimj7fl6ze8q5rf3}}"
```

### Install Alibaba CloudProvider support.

CloudProvider needs certain permissions to access Alibaba Cloud, you will need to create a few RAM policies for your ECS instances or use AccessKeyID&Secret directly.
CloudProvider needs certain permissions to access Alibaba Cloud, you will need to create a few RAM policies for your ECS instances or use AccessKeyID and AccessKeySecret directly.

**RAM role Policy**

[What is the RAM role of an instance](https://www.alibabacloud.com/help/doc-detail/54235.htm)

The sample [master policy](examples/master.policy) is a bit open and can be scaled back depending on the use case. Adjust these based on your needs.

**AccessKeyID & AccessKeySecret**
**AccessKeyID and AccessKeySecret**

Or we use Alibaba AccessKeyID&Secret to authorize the CloudProvider. Please make sure that the AccessKeyID has the listed permissions in [master.policy](examples/master.policy)
Or we use Alibaba AccessKeyID AccessKeySecret to authorize the CloudProvider. Please make sure that the AccessKeyID has the listed permissions in [master.policy](examples/master.policy)

[How to get AccessKey?](https://usercenter.console.aliyun.com/#/manage/ak)

Expand Down

0 comments on commit 7c67f42

Please sign in to comment.