Github





Creating an application


│ ├─ Heavy Metal Guitar School ── Chart │ ├─ Heavy metal Guitar School ── Charts # │ ├─ Heavy metal Guitar School # │ ├─ Heavy metal Guitar School ── NOTES │ │ ├ ─ ─ _helpers. TPL │ │ ├ ─ ─ deployment. The yaml │ │ ├ ─ ─ ingress. The yaml │ │ └ ─ ─ service. The yaml │ └ ─ ─ values. The yaml # variable ├ ─ ─ Dockerfile # Dockerfile definition ├ ─ ─ entrypoint. Sh # container entrypoint. Sh file ├ ─ ─ MVNW ├ ─ ─ MVNW. CMD ├ ─ ─ pom. The XML ├ ─ ─ the SRC # application source │ └ ─ ─ │ ├─ Java │ ├─ Java │ ├─ Java │ ├─ Java │ ├─ Java │ ├─Copy the code











Building container images


├── EntryPoint.sh/entryPoint.sh/entryPoint.sh/entryPoint.sh/entryPoint.shCopy the code








Build FROM Maven: 3.5.0-jdK-8-alpine AS builder ADD./pom.xml pom.xml ADD./ SRC SRC/RUN MVN clean package package package FROM maven: 3.5.0-JDK-8-alpine AS builder ADD./pom.xml pom.xml ADD./ SRC SRC/RUN MVN clean package package package FROM Maven Jar gs-spring-boot.jar RUN bash -c 'touch /gs-spring-boot.jar' ADD entrypoint.sh entrypoint.sh RUN chmod +x entrypoint.sh ENTRYPOINT ["./entrypoint.sh"]Copy the code






mvn clean package








! /usr/bin/env bash ACTIVE_PROFILE=${PROFILE:=default} java -Xmx1024m -Djava.security.egd=file:/dev/./urandom -jar gs-spring-boot.jar --spring.profiles.active=${ACTIVE_PROFILE} $@Copy the code






--spring.profiles.active=prod








$docker build -t yunlzheng/spring-app. # Sending build context to Docker Daemon 16.38MB Step 1/10: Maven: 3.5.0-JDK-8-alpine AS Builder --> 67d11473f554...... Successfully built e332622092ce Successfully tagged yunlzheng/spring-app:latestCopy the code








Docker push yunlzheng/spring-app # modify to own mirror repositoryCopy the code





Build a Chart


│ ├── Chart │ ├── Chart # Chart │ ├── Charts # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart # Chart _helpers. TPL │ │ ├ ─ ─ deployment. The yaml │ │ ├ ─ ─ ingress. The yaml │ │ └ ─ ─ service. The yaml │ └ ─ ─ values. The yaml # variablesCopy the code








$ helm create chart
Creating chart
Copy the code








ApiVersion: v1 appVersion: "1.0" Description: A Spring Boot Application name: Chart Version: 0.1.0Copy the code








ReplicaCount: 1 image: repository: yunlzheng/spring-app # Change it to its own image tag: latest pullPolicy: IfNotPresent service: type: ClusterIP port: 8080 # ingress port container mapping: enabled: true # open cluster ingress annotations: # {} kubernetes. IO/ingress. The class: nginx # kubernetes.io/tls-acme: "true" path: / hosts: - spring-example.local tls: []Copy the code














deployment.yaml
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "chart.fullname" . }}
labels:
app: {{ template "chart.name" . }}
chart: {{ template "chart.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
  app: {{ template "chart.name" . }}
  release: {{ .Release.Name }}
template:
metadata:
  labels:
    app: {{ template "chart.name" . }}
    release: {{ .Release.Name }}
spec:
  containers:
    - name: {{ .Chart.Name }}
      image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
      imagePullPolicy: {{ .Values.image.pullPolicy }}
      ports:
        - name: http
          containerPort: 8080
          protocol: TCP
Copy the code














$ cd chart
$ helm lint
==> Linting .
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, no failures
Copy the code








$CD chart $helm install. Omit other output ==> v1/Service NAME TYPE cluster-ip external-ip PORT(S) AGE Womping-sparrow-spring-app ClusterIP 172.19.11.41 < None > 8080/TCP 1S NOTES: 1. Get the application URL by running these commands: http://spring-example.local/Copy the code


















Release Chart


$ cd .. $ helm package chart Successfully packaged chart and saved it to: / Users/yunlong/workspace/project - samples/containerization - spring - with - helm/chart - 0.1.0 from. TGZCopy the code






helm package


$helm package chart --version 0.0.2 Successfully packaged chart and saved it to: / workspace/TMP/spring - sample/chart - hundreds. TGZCopy the code












Chartmusem






Ali cloud effect
Open private warehouse service






Ali cloud effect
--username=kHKvnX
--password=WsCH7zuHH2


helm repo add play-helm https://repomanage.rdc.aliyun.com/helm_repositories/26125-play-helm --username=kHKvnX --password=WsCH7zuHH2
Copy the code






Helm Push
Cloud effect








$helm plugin install https://github.com/chartmuseum/helm-push for Downloading and installing helm - push v0.7.1... https://github.com/chartmuseum/helm-push/releases/download/v0.7.1/helm-push_0.7.1_darwin_amd64.tar.gz Installed plugin: pushCopy the code








$helm push chart-0.1.0. TGZ PLAY-helm Pushing chart-0.1.0. TGZ to play-helm Pushing chart-0.1.0. Done.Copy the code








$ helm update ... Successfully got an update from the "play-helm" chart repository ... Successfully got an update from the "stable" chart repository update complet. ⎈ Happy Helming! ⎈Copy the code








$helm Search Play -helm NAME CHART VERSION APP VERSION DESCRIPTION play-helm/ CHART 0.1.0 1.0 A Spring Boot Application $  helm install play-helm/chartCopy the code





Other tips


$helm push chart-0.1.0.TGz play-helm --version=0.2.0 Pushing chart-0.2.0.tgz to play-helm... Done.Copy the code








$helm push chart play-helm --version=0.3.0 Pushing chart play-helm... Done.Copy the code








$ helm push chart https://repomanage.rdc.aliyun.com/helm_repositories/26125-play-helm --username=kHKvnX - the password = WsCH7zuHH2 Pushing chart - 0.1.0 from. TGZ to https://repomanage.rdc.aliyun.com/helm_repositories/26125-play-helm... Done.Copy the code





summary











The resources

  • Making Helm project
  • Making Chartmuseum project
  • Making Chartmuseum project
  • Helm Push plug-in
  • Cloud effect one-stop enterprise collaborative research and development cloud
  • Cloud effect private warehouse services