Deploy Virtual Nodes Quickly with Container Service for Kubernetes

Diverse Combinations of Containers and Serverless

Serverless Kubernetes

Kubernetes Virtual Nodes

Elastic Container Instance and Virtual Kubelet

ECI

  • Infrastructure management is not required to run containers.
  • Flexible on-demand usage scenarios and per-second billing are available.
  • The sandbox security technology ensures the application security.

Virtual Kubelet

Deploy Virtual Nodes in Alibaba Cloud Managed Kubernetes Clusters

1. Enable ECI

2. Create a Managed Kubernetes Cluster

3. Use kubectl to Deploy Virtual Nodes in One Click

# cat alicloud-virtual-nodes-eci.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: alicloud-virtual-nodes-eci
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: alicloud-virtual-nodes-eci
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: alicloud-virtual-nodes-eci
namespace: kube-system
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: alicloud-virtual-nodes-eci
namespace: kube-system
labels:
app: alicloud-virtual-nodes-eci
spec:
replicas: 1
selector:
matchLabels:
app: alicloud-virtual-nodes-eci
template:
metadata:
labels:
app: alicloud-virtual-nodes-eci
spec:
serviceAccount: alicloud-virtual-nodes-eci
containers:
- name: alicloud-virtual-kubelet
image: registry.cn-hangzhou.aliyuncs.com/ask/virtual-nodes-eci:v1.0.0.1-aliyun
imagePullPolicy: Always
args: ["--provider", "alibabacloud"]
env:
- name: KUBELET_PORT
value: "10250"
- name: VKUBELET_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: VKUBELET_TAINT_KEY
value: "virtual-kubelet.io/provider"
- name: VKUBELET_TAINT_VALUE
value: "alibabacloud"
- name: VKUBELET_TAINT_EFFECT
value: "NoSchedule"
- name: ECI_REGION
value: "cn-hangzhou"
- name: ECI_VSWITCH
value: "xxx"
- name: ECI_SECURITY_GROUP
value: "xxx"
- name: ECI_ACCESS_KEY
value: "xxx"
- name: ECI_SECRET_KEY
value: "xxx"
# kubectl apply -f ./alicloud-virtual-nodes-eci.yaml
serviceaccount "alicloud-virtual-nodes-eci" created
clusterrolebinding "alicloud-virtual-nodes-eci" created
deployment "alicloud-virtual-nodes-eci" created
# kubectl -n kube-system get pod|grep virtual-nodes
alicloud-virtual-nodes-eci-54b748489c-gkcmn 1/1 Running 0 53s
# kubectl get node
NAME STATUS ROLES AGE VERSION
cn-hangzhou.i-bp19cyop0b1skne04djt Ready <none> 10m v1.11.2
cn-hangzhou.i-bp19cyop0b1skne04dju Ready <none> 10m v1.11.2
cn-hangzhou.i-bp19cyop0b1skne04djv Ready <none> 10m v1.11.2
virtual-kubelet Ready agent 55s v1.11.2

4. Deploy a Pod to the Virtual Node

# cat nginx.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
nodeSelector:
kubernetes.io/role: agent
beta.kubernetes.io/os: linux
type: virtual-kubelet
tolerations:
- key: virtual-kubelet.io/provider
operator: Exists
# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx 1/1 Running 0 1m

Summary

Reference Links

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A Quick Guide to Analyzing Apache Logs on Alibaba Cloud Log Service

Scrum Framework

Knative on Alibaba Cloud: The Ultimate Serverless Experience

How to Track fails on ETL

Intuitive understanding of List comprehension in Python

System Design — Distributed Job Scheduler

Chain of Responsibility: A scalable approach to authorization

abbr in software engineering — part 7 — note of CH10 of the textbook

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

ELK vs Prometheus/Grafana/Jaeger

How to backup and restore the ETCD in the Rancher cluster

Tekton: Building a Pipeline (Part 4)

How to Monitor Endpoints in Kubernetes using Blackbox Exporter