How to quickly deploy applications container

One, background

In order to quickly adapt and meet the market demand, small and fast growing number of applications, "these bits and pieces of how to deploy applications, manage?" Has become a headache for everyone. If all of the virtual machines, resource consumption is too large. In this case, the application of the container, is obviously a very good choice, but many companies are both faced with the same question, and that is the implementation of the container difficult.

The process of implementation of the container, development, operation and maintenance costs of learning and use are very high, and that there is not an easy to use platform?

Kepler cloud platform is pleasant Jinke - a wealth of open source technology department based application management Kubernetes solutions. The container company is committed to solving the difficult, hard on Kubernetes, operation and maintenance cost is high. Applications only need to add a very simple file Dockerfile head by Kepler will be able to deploy applications on Kubernetes, greatly reducing the difficulty of use.

How to quickly deploy applications container

Second, Kepler cloud platform

A previous article Kubernetes + Docker + Istio container cloud practice of Kepler platform to do some basic introduction.

After a period of adjustment, we finally put this open source platform: https://github.com/kplcloud/kplcloud

Kepler is a cloud platform for the development, operation and maintenance platforms and other groups, only requires simple knowledge can quickly deploy applications to Kubernetes, the following is an infrastructure platform:

How to quickly deploy applications container

Kepler platform can either run through the container on Kubernetes, it can also be deployed independently.

To complete the implementation of the deployment on kubernetes master node, of course, before the need to increase app.cfg profile.

$ git clone github.com/kplcloud/kplcloud && cd kplcloud/
$ kubectl apply -f install/kubernetes/kpaas/

The figure is Kepler cloud platform docking platform and processes.

How to quickly deploy applications container

Kepler cloud platform by calling Jenkins, Gitlab (Github), Kubernetes API such as the way the application operates.

The Consul of KV feature to use as a distribution center in the Kepler cloud platform can directly call the Consul API operation, you can decide whether to enable Consul KV function in the configuration file.

Jenkins is currently only served as the code is compiled and Docker image upload warehouse. Kepler to create a Job or Build Job by calling JenkinsAPI, and listens Job status.

Kepler platform also calls Github or Gitlab API branches and tags need to get on-line projects. And pass jenkins information, Jenkins related execution code and pulling the build process.

Third, the use

Platform Invoke Kubernetes API resources and Jenkins API or alarms are processed in a manner template, administrator template can be adjusted according to your company's resources the environment.

In addition to the basic requirements for the production, also increased the demand for support for the test environment testers.

  • With cloning: test may need to do a version of the scene sets the environment. In a space platform can assume a kind of scenario, after all the applications have been deployed at a space, the application need to be generated in the same space at the other, for ease of operation, can be used directly "toolset - clone" function key to complete a clone .
  • Time adjustment container: financial products should encounter adjust the time of issue. Testing is usually a function of the need to modify the time of the service, due to the Docker uses a kernel time host, the container can not be adjusted kernel time, it would need the help of other tools to get the job done. We recommended to use an open source toolhttps://github.com/wolfcw/libfaketime , we compiled the tool to the host, by way of engagement of the mounted containers, the individual containers can be adjusted without affecting the other containers.

Kepler numerous cloud platform capabilities, we are more concerned with the following pick a few, brief introduction to commonly used functions. (More features, but they view the documenthttps://docs.nsini.com

  • Creating an application
  • New release
  • Log collection
  • Monitoring Alarms
  • Persistent storage

3.1 to create applications

Create an application process is very simple, just fill out some simple information, it will be executed after the building administrator review. Application upgrades only need to select tags, and then execute the build can be completed.

How to quickly deploy applications container

Go to create a application, for example:

Dockerfile:

FROM golang:latest as build-env

ENV GO111MODULE=on
ENV BUILDPATH=github.com/kplcloud/hello
RUN mkdir -p /go/src/${BUILDPATH}
COPY ./ /go/src/${BUILDPATH}
RUN cd /go/src/${BUILDPATH} && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -v

FROM alpine:latest

COPY --from=build-env /go/bin/hello /go/bin/hello

WORKDIR /go/bin/
CMD ["/go/bin/hello"]

The above Dockerfile into the project directory, fill out the information:

How to quickly deploy applications container

An application to create complete, review the information submitted by the administrator if qualified, unqualified they dismissed; qualified directly and through deployment.

Application deployment will get us the basis of pre-defined templates based on information submitted by the user, and then generate resources that can be identified according to Kubernetes base template, then call Kubernetes API to create these resources. Created after the call Jenkins API to create a Job, and finally execute the build.

Jenkins has finished its construction and Docker Image After uploading the warehouse, Kepler will update Kubernetes version related applications.

To this was added more during operation, you can modify JenkinsCommandthe template.

3.2 publish a new app

The application build process is handled by creating some of the information submitted application.

  • Get a list of tags from the git repository.
  • Jenkins API calls related parameters of the application and version information to it and build.
  • Jenkins Job Shell command execution, execution docker build and upload it to Docker Image warehouse.
  • Platform to monitor job has been successfully performed, kubernetes API call to update the application Image address.
  • Monitor upgrades.
  • Send notifications.

These are the building back-end process applications, while the front end is relatively simple, just click on the "Build" button in the application details page, in the pop-up dialog box, select the version you want to apply tags and submitted on the line, as shown below:

How to quickly deploy applications container

Click on the details page of build log tab displays the most recent building records, click on the appropriate version on the left, you can see the version of the building, the application can also interrupt being built, as shown below:

How to quickly deploy applications container

3.3 log collection

Our log collection uses loosely coupled, scalable, easy to maintain and upgrade programs.

  • Each host node Filebeat collected logs.
  • Each Pod injection Filebeat container collection job log.

Filebeat deployed together with an application container, applications do not need to know it's there, you only need to specify the directory log input on it. Filebeat configuration is used to read from ConfigMap, only you need to maintain a good rule to collect logs.

How to quickly deploy applications container

If you configure the above acquisition, the Pod where it will serve to inject a Filebeat log collector application services to business acquisition. To collect the log kafka injected into the cluster, then message processing and formatting logstash.

ES dealt into clusters, and ultimately we will be able to query the log business by kibana.

How to quickly deploy applications container

Filebeat filebeat containers and can also be of ConfigMap parameter adjustment by way of the stencil.

How to quickly deploy applications container

3.4 Monitoring Alarms

Application monitoring alerts is also very important aspect, we use Prometheus + Grafana program monitoring, Prometheus + AlertManager processed alarms.

AlertManager thrown Kepler alarm information is sent to the cloud platform for processing, if you subscribe to the alert type of message platform type of tools will be sent to the subscription.

We can - choose the type of tool and received subscription-based "personal settings message subscription settings":

How to quickly deploy applications container

The following is a micro-channel of the received operation notification:

How to quickly deploy applications container

More tutorials please consult the documentation we provide.https://docs.nsini.com

3.5 persistent storage

Kubernetes cluster administrator by providing different storage classes, to meet the storage needs of different user quality of service levels, backup policy and any policy requirements. Dynamic storage volume supply using StorageClass to implement, allow storage volumes to be created on demand.
If there is no dynamic storage provisioning, administrators Kubernetes cluster will have to create a new storage volume by manually.
By dynamic storage volumes, Kubernetes able to follow the needs of users, automatically create their storage needs.

How to quickly deploy applications container

Find the "Configuration stored" in the menu -> "persistent storage volumes Statement", a choice of applications, and click the "Create" button, create a storage volume, and then we find the need to mount a persistent disk storage application and enter details page, find the "persistent storage" tab, mount persistent storage volumes created just enough.

How to quickly deploy applications container

Fourth, the tail

Kepler platform is currently open, and there demonstration platform can be used to provide complete documentation for reference. Document describes the process of building-related services in detail, at the same time, offers a variety of deployment scenarios.

Author: Cong

CreditEase Institute of Technology

Guess you like

Origin blog.51cto.com/14159827/2446228