创建一个Kubernetes群集

Below you will find examples of creating a small 3 node Kubernetes cluster to try NATS on multiple clouds.

Google Kubernetes Engine

Use gcloudarrow-up-right to create a 3 node regionalarrow-up-right Kubernetes cluster on us-west2.

# Create a 3 node Kubernetes cluster. One node in each of the region's three zones.
gcloud container clusters create nats-k8s-cluster \
  --project $YOUR_GOOGLE_CLOUD_PROJECT \
  --region us-west2 \
  --num-nodes 1 \
  --machine-type n1-standard-2

Note that since this is a regional cluster we are specifying --num-nodes 1 which will create a kubelet on 3 different zones. If you are creating a single-zone clusterarrow-up-right but want 3 nodes then you have to specify --num-nodes 3.

Amazon Kubernetes Service

The eksctlarrow-up-right is a very helpful tool to manage EKS clusters, you can find more docs on how to set it up herearrow-up-right.

# Create 3 node Kubernetes cluster
eksctl create cluster --name nats-k8s-cluster \
  --nodes 3 \
  --node-type=t3.large \
  --region=eu-west-1

# Get the credentials for your cluster
eksctl utils write-kubeconfig --name $YOUR_EKS_NAME --region eu-west-1

Digital Ocean

You can use doctlarrow-up-right to create a cluster as follows:

Azure Kubernetes Service

Using azarrow-up-right you can create a cluster like this:

Eventually your cluster will be provided ExternalIPs that the NATS cluster can advertise to clients:

最后更新于