As the Internet age continues to evolve, developers can find themselves in a situation where “innovations” that are designed to solve problems and make development more efficient seem to diminish their importance in the company, or even replace them. For example, in the era of cloud native, some enterprises prefer to choose K8s to solve the problems of operation and maintenance and flexibility, rather than building a R&D team that needs to spend a lot of money on hiring and managing funds.
The value of K8s is that it not only helps companies reduce maintenance costs, but it also provides flexibility, agility and portability, but the value of K8s to developers is not just that we can solve the same problems as K8s, but that we can get out of trouble. Think about how you can use K8s more flexibly and efficiently to improve your overall skills.
Technical personnel involved in development, always around is to deploy the application to the corresponding server, today to explain to you, for container service K8s, how to achieve a real “one-click deployment”, improve the efficiency of development and deployment, in the use of K8s to achieve a faster step. The following is an outline of the article:
- What is container service K8s
- How to implement “one-click deployment” to container service K8s
- How to achieve “one-click deployment” to host, 8 times faster development deployment
What is container service K8s
Container service is based on the original K8s K8s adaptation and enhanced, simplify cluster building and expansion, etc, to provide high-performance scalable application container management ability, support enterprise container application of whole life cycle management, integration of ali cloud virtualization, storage, network and security capabilities, to build the cloud best container application runtime environment. The core functions are as follows:
- Cluster management: Allows you to create and delete clusters in different regions based on your requirements.
- Multiple server hosting modes: Authorize container services to create cloud servers and add purchased cloud servers to a specified cluster.
- One-stop container lifecycle management: network, storage, logging, monitoring, scheduling, routing, and permissions.
- Flexible expansion of scheduling policies enables easy access to upstream and downstream delivery processes. Supports affinity policies at the service level and Openapis for horizontal expansion, cross-AZ high availability and disaster recovery, cluster and application management, and easy connection between continuous integration and private deployment systems.
How to implement “one-click deployment” to container service K8s
There are many ways to improve the efficiency of development and deployment. Today I’m going to share with you a native IDE plug-in, Cloud Toolkit, which is said to be one of the most used plug-ins by developers. It not only automates the entire process from code development to final deployment, It can be deployed to any server & cloud (ECS, EDAS, K8s, Applets, etc.) and comes with many features: Arthas diagnostics, Dubbo tools, Terminal, file uploads, MySQL executors, and most importantly: free! For free! For free! A lot of blogs on the net, technical website, public number have relevant evaluation, we can refer to see, or their own installation trial, must try [one key deployment] function! Here’s how to use the plug-in to deploy your application to the container service K8S with one click.
(1) Install plug-ins
Free plug-in links: www.aliyun.com/product/clo…
(2) Configure plug-in preferences
Click: Tools –> Alibaba Cloud Toolkit–> Preferences–> Alibaba Cloud Toolkit–> Accounts on the left side of the list, the following interface appears, configure the AK and SK of Ali Cloud account, The preference configuration is complete. (If it is a sub-account, enter the AK and SK of the sub-account.)
(3) Set up local Docker image packaging
Click on the top menu Tools > Alibaba Cloud Toolkit > Preferences –> Alibaba Cloud Toolkit on the left side of the list –> Docker, as shown below, set up the local Docker image package.
(3) Deploy applications
In Intellij IDEA, right-click the project name and from the menu that appears, click Alibaba Cloud –> Deploy to CS Kubernetes… The following deployment window is displayed:
Step 1: Set the Image
- In the Image TAB, select the local application’s Context Directory and Dockerfile (which are usually automatically identified and set based on your local application project).
- Select the region, namespace, and mirror repository for the Container mirroring service, and then click the Container TAB.
(Note: If you do not already have an image repository, click Create a New Repository in the upper right corner of the dialog box to go to the Container Image Repository and Create an image repository. For details about how to Create an image repository, refer to the Container Image Repository documentation.)
Step 2: Set up the Container
- On the Container TAB, select Deployment, Clusters, and Namespace for the Container service Kubernetes.
- Select the specified Container.
(note: If you have not already created the Deployment for the container service Kubernetes, click Create a New Kubernetes Deployment in the upper right corner of the dialog to jump to the container service Kubernetes console to Create Deployment, Please refer to the Container Services Kubernetes documentation for creation steps.
Step 3: Perform the deployment
After clicking the Run button, the deployment of the local application to the container service Kubernetes is complete.
Iii. How to achieve “one-click deployment” to host to speed up development and deployment by 8 times
The plugin can be deployed to six servers:
- Host (any server)
- ECS
- CS K8s
- EDAS (including EDAS for ECS Application & EDAS for K8s Application)
- Mini Program (Small Program Cloud)
- SAE
Here’s how to deploy an application to host with one click.
Step 1: Add a server
- Click: Top menu Tools –> Alibaba Cloud –> Alibaba Cloud View –> Host to open the machine View interface, as shown below:
- Click the “Add Host” button in the upper right corner, and the interface of adding machines will appear, as shown in the picture below, to set relevant configurations.
Step 2: Perform the deployment
In IntelliJ IDEA, right-click the project name and from the menu that appears, click Alibaba Cloud –> Deploy to Host… The following deployment window is displayed. Set deployment parameters and click Deploy to perform the initial deployment.
Deployment parameters:
1. Deploy File: The deployment File can be deployed in either of the following ways:
* Maven Build: If your current project is built using Maven, you can Build and deploy it directly using the Cloud Toolkit.
* Upload File: If the current project is not built using Maven, or a packaged deployment File already exists locally, you can select and directly Upload the local deployment File.
2. Target Deploy host: Select Tag from the drop-down list and select the server to be deployed.
3. Deploy Location: Enter the deployment path on the ECS, for example, /root/tomcat/webapps.
Commond: Enter the application startup command, for example, sh /root/restart.sh. Represents the command that needs to be executed after the application package is deployed — typically a Tomcat startup command for Java programs.
Finally, hope today recommend plug-in can really help you to improve the efficiency of the development and deployment, improve the ability on the use of the tool, you can install the trial, you can join a community questions, have any questions about heard that their customer service is first class, there is all sorts of contests/qualifying, and recently have 2 chance of high activity, Click this link at the end of the article to see the details of the event.
Welcome to pay attention to my official account: Program ape DD, for exclusive learning resources and daily dry goods push.
If you are interested in my feature content, you can also follow my blog: didispace.com