In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to deploy Kubernetes cluster on Azure, for this problem, this article details the corresponding analysis and solution, hoping to help more small partners who want to solve this problem find a simpler and easier way.
During experiments, demos, or production, I often need to run some Docker load. While this is pretty easy on your local computer, it's a bit more difficult when you're running in the cloud. Running in the cloud is much more complicated than running locally. I tried several approaches, such as running Docker on AWS Beanstalk, AWS ECS, or Azure ACS DC/OS, but they were too complex and restrictive for my needs.
Azure announced Azure Container Service pre-support for Kubernetes, and Kubernetes announced ACS support at the same time, so it's time to give Kubernetes a try.
You can skip all the steps and just read the demo deployment and instructions by clicking on the link: https://github.com/chaliy/play-azure-kubernetes.
introduced
So, what are Kubernetes? To sum it up in one simple sentence: it is a container orchestration tool. The first step is to package the applications, and Kubernetes can then deploy, run, and scale the packaged applications. To learn more, you may need to go through Tutorial, but it's so easy that you can skip this step and try to run it.
the infrastructure needed to
In this article, I will use the new Azure CLI. Installation is very simple, in most cases, just need to "pip install azure-cli" will do.
So now let's preview our cluster. First, you may need resource groups to isolate your infrastructure.
az group create -n my-very-own-k8s-cluster -l "West Europe"
And then there's the regulation cluster.
az acs create -n my-very-own-k8s-cluster \ -g my-very-own-k8s-cluster \ --dns-prefix my-very-own-k8s-cluster \ --orchestrator-type kubernetes
While waiting for the order to be completed, let's look at some comments.
If you have some problems with your commands, such as some meaningless errors in these commands, adding the-debug parameter is a bit verbose, but some errors will occur.
2, -dnsprefix is optional, personal advice or to add it, otherwise, it will be used according to the "cluster name + group name", if more than 90 characters in length, after the operation will appear strange errors.
By default, ACS sets up clusters with a single master and three agents. These steps are set to use D2 by default, so this cluster is expensive, remember to clean up resources when you don't need them.
And, welcome to Kubernetes 'ACS engine at https://github. com/Azure/acs-engine/blob/master/docs/kubernetes.md. The above gives some great ideas for implementation. Note that ACS documentation doesn't use the new Azure tools, so it can be a bit more complicated.
First payload
All infrastructure is ready and Kubernetes deployment is now underway. To manage clusters, kubectl is required. You can run it automatically with the following code (you may need to add it to PATH yourself):
az acs kubernetes install-cli
Next, you need to authenticate kubectl with clusters.
az acs kubernetes get-credentials -n my-very-own-k8s-cluster \ -g my-very-k8s-cluster
Check if everything is OK. This command line provides both client and server versions.
kubectl version
From here on out, you already have what you need to run your first payload. So let's create the first definition file and try it out. Definition files in Kubernetes can use many file formats, I use YAML, so we create hello.yml file with the following:
apiVersion: extension/v1beta1 kind: Deployment metadata: name: hello # Name of the deployment, just for reference purposes spec: replica: 1 # Number of instances for the given application template: metadata: labels: app: hello spec: containers: - name: ner-uk-ms # Name of container, could be anything you like image: chaliy/ner-ms:uk # Docker image to run ports: -containerPort:8080
It is important to understand some Kubernetes terminology.
Pod--Container instance--http://kubernetes.io/docs/user-guide/pods/Deployment--Ensure pods can run, play the role of supervisor--http://kubernetes.io/docs/user-guide/deployments/Service--Assemble pods into a system--http://kubernetes.io/docs/user-guide/services/
So, for a single pod defined in a template, the definition file we just created is a deployment. The following command line pulls the Docker image `chaliy/ner-ms:uk`, opens its instance and sets the supervisor:
kubectl create -f ./ hello.yml
There are very few command lines available today:
# Retrieve logs associated with deployment kubectl logs hello# List Pods kubectl get pods# List deployments kubectl get deployments# Details about concrete pod, for example in case of errors kubectl describe pods/podid
If you want to reconfigure the application, you can modify it in the definition file, such as setting `replicas:10`, and then run:
kubectl apply -f ./ hello.yml
Technically, it's already running payloads. Let's see how it works. Kubernetes UI presents cluster health to users. It works the same way as an application. Of course, if you don't want this UI to appear outside the cluster, you can run it only inside the cluster by default. But what if they visit?
Kubernetes implements the Basteon pattern and proxies to your local computer in a simple way. So first you need to run the agent:
kubectl proxy --port=8000
Then you need to see Kubernetes Dashboard immediately. You can browse: http://localhost:8000/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard
Also, you may need to publish services outside the cluster. For this, you need to create a service (for Kubernetes) and then use the expose command, with the new Loadbalancer.
kubectl expose deployment hello --type="LoadBalancer"--port=80 -- target-port=8080
This command line will start setting the new load balance, which will take a while. To check if it works, query for information about service:
kubectl get services/hello
You will then see the external IP address, which means the service is OK and you can use it to send requests. Similar to:
curlhttp://EXTERNAL-IP/
All scripts can be found at https://github.com/chaliy/play-azure-kubernetes. Here you can find some real-world examples of using Nginx proxy as a router.
conclusion
For me, the user experience has been great, but I'm not sure I'll continue to use it because there are a few issues that still bother me:
Kubernetes ACS version is still in the pre-release stage, some features have not yet been implemented (for example, you can not scale your cluster).
2, the use of high cost, at least 4D2 nodes, may cost up to $1000 per month. It's okay to use a smaller instance, but my load type doesn't know how to use it yet.
There is currently no equipment that can create a system. Similar to docker-compose can provide related services.
The answers to questions about how to deploy Kubernetes clusters on Azure are shared here. I hope the above content can help you to some extent. If you still have a lot of doubts, you can pay attention to the industry information channel to learn more.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.