Aliyun essentials for Kubernetes. It provides SLB, Routes controllers and a Volume plugin for Kubernetes to function properly on Aliyun instances.
- Service load balancers sync (TCP & UDP)
- Routes sync
- Volumes attaching & mounting (via flexvolume for now)
There are two components. They run independently.
aliyun-controller is a daemon responsible for service & route synchronization. It has to run on all master nodes.
aliyun-flexv is a binary plugin responsible for attaching & mounting volumes on node. It has to be deployed on all nodes and will be called by kubelets when needed.
kubeup/kube-aliyun
- Make sure all node names are internal ip addresses.
- Make sure node cidr will be allocated by adding
--allocate-node-cidrs=true --configure-cloud-routes=false
tokube-controller-manager
commandline. - Update the required fields in
manifests/aliyun-controller.yaml
- Upload it to
/etc/kubernetes/manifests
on all your master nodes - Use docker logs to check if the controller is running properly
- Update the kubelet systemd file on every node to include these required environment variables:
- ALIYUN_ACCESS_KEY
- ALIYUN_ACCESS_KEY_SECRET
- ALIYUN_REGION
- ALIYUN_INSTANCE (the instance id of the node in Aliyun)
- Add to kubelet commandline an option
--volume-plugin-dir=/opt/k8s/volume/plugins
- Run on each node
FLEXPATH=/opt/k8s/volume/plugins/aliyun~flexv; sudo mkdir $FLEXPATH -p; docker run -v $FLEXPATH:/opt kubeup/kube-aliyun:master cp /flexv /opt/
- Customizing volume plugin path is optional. You can just use the default which is
/usr/libexec/kubernetes/kubelet-plugins/volume/exec/
.
Just create Loadbalancer Services as usual. Currently only TCP & UDP types are
supported. Some options can be customized through annotaion on Service. Please
see pkg/cloudprovider/providers/aliyun/loadbalancer.go
for details.
No flannel or other network layer needed. Pods should be routed just fine.
In pod definition, use flexVolume
type as in the example and that's it.
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- name: test
mountPath: /data
ports:
- containerPort: 80
volumes:
- name: test
flexVolume:
driver: "aliyun/flexv"
fsType: "ext4"
options:
diskId: "d-1ierokwer8234jowe"
Apache Version 2.0