Kubernetes on Tencent Cloud: From Zero to Running
Intro
Tencent Cloud’s managed k8s had been around for a while and supports joining your own hosts. Time to experiment.
What is k8s (quickly)?
Kubernetes is an open-source system for automating deployment, scaling, and management of containerized apps. It groups containers into logical units for easy management and discovery.
Plainly: we containerized our services already; k8s orchestrates and manages those containers.
Step 1: Create a Cluster
- In your cloud console, find “Container Service”, create a managed cluster, click through the wizard.
- Join your existing or new instances as worker nodes.
Two node types:
- master: runs k8s control-plane (etcd, etc.)
- worker: runs your workloads (Pods)
Managed clusters hide master ops; you manage/join your workers.
Step 2: kubectl
Install kubectl and connect to the cluster (see your cloud docs). Verify:
|
|
Concepts: Pod and Service
- Pod: one or more container instances of an app.
- Service: stable, virtual IP/endpoint inside the cluster that load-balances to Pod replicas.
Example: A scalable web API runs 3 replicas in one Deployment/Pod template; a Service exposes a single endpoint that forwards to replicas.
First Deployment & Service
Save as sample.yaml
, then run kubectl apply -f sample.yaml
.
|
|
Apply and check:
|
|
From a host on the same VPC:
|
|
Cleanup:
|
|