Deploying an Application to Container Service for Kubernetes

In the previous article, we have discussed how to deploy a local Java application directly to an Alibaba Cloud ECS instance. For those who are already using Alibaba Cloud Container Service for Kubernetes, you may be wondering how to use this plug-in to deploy applications on Container Service for Kubernetes. In this article, we will answer this question and explain how to deploy applications to Alibaba Cloud Container Service for Kubernetes.

Image for post
Image for post

About Container Service for Kubernetes

Alibaba Cloud Container Service for Kubernetes provides enterprise-level high-performance and flexible management of Kubernetes containerized applications throughout the application lifecycle. This service simplifies cluster creation and expansion and integrates Alibaba Cloud capabilities in virtualization, storage, network, and security, providing an improved running environment for Kubernetes containerized applications.

Develop an Application Locally

This article takes a Java servlet for printing “Hello World” on a Web page as an example to explain the deployment method.

Image for post
Image for post
public class IndexServlet extends HttpServlet {
private static final long serialVersionUID = -112210702214857712L;
@Override
public void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException {
PrintWriter writer = resp.getWriter();
// Demo: Use Alibaba Cloud Toolkit to modify the code of a local application and deploy the application to the cloud.
writer.write("Deploy from alibaba cloud toolkit. 2018-10-24");
return;
}
@Override
protected void doPost( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException {
return;
}}
FROM tomcat:8.5.34-jre8
COPY target/javademo.war /usr/local/tomcat/webapps/

Install Plug-in

Alibaba Cloud provides an Eclipse-based plug-in to help developers efficiently deploy applications written in the local IDE to Container Service for Kubernetes.

Configure the Plug-in Preferences

After installing the plug-in, configure the preferences by choosing:

Image for post
Image for post
Image for post
Image for post

Deploy the Application

Image for post
Image for post

Step 1

Image for post
Image for post

Step 2

Image for post
Image for post

Step 3

Image for post
Image for post

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

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