As a project team, every engineer should know the basics of docker/kubernetes Raise interest to inspire some of you to take up trainings For the sceenshots, we are going to show whatever is used in Prodia project
Zuhlke Engineering Asia
Kevin: what does it take to deploy to the Cloud? Kin: so you want the service to be accessible by others? Kevin: Yes... Kin: wouldn't it be nice if you don't need to worrying about dependencies...? Kevin: Sure, how can I do that? Kin: Put it in a container
Zuhlke Engineering Asia
Kevin: What is a container? Kin: Containerisation or dockerization ... is a form of virtualisation which is much lighter weight than VMs Kevin: okay... Kin:
Kevin: yeah, but how do I have a container?
Zuhlke Engineering Asia
Kin:
Kevin: Okay, so it is better to keep it small then Kin: (explain about the file) Kevin: then what's next?
--
FROM amazoncorretto:18-alpine-jdk
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/app.jar"]
--
Zuhlke Engineering Asia
Kin: (read slide) Kevin: Do I need to do this every I want to build a docker image? How do I make sure these steps are run every time correctly? Kin: If you want to automate this step, we need a CI platform
Zuhlke Engineering Asia
Kevin: Okay, can you show me what a CI platform looks like? Kin: sure
Zuhlke Engineering Asia
1) a CI pipeline has a few common steps, such as test, build, scan, package, and the last step might involve deployment 2) a pipeline is normally triggered by a code commit and it should be done automatically 3) any unsuccessful builds or tests should be reported by the CI platform immediately 4) since every operation is recorded, we are able to know who is responsible for each build Kevin: Wow, that's pretty cool. You can see each step very clearly and even logs as well. Kin: Yep
Zuhlke Engineering Asia
Kevin: Is it hard to setup a CI pipeline? how to create one?
Zuhlke Engineering Asia
Kevin: so after a CI pipeline is done, where is my application? has it been deployed to the cloud yet?
definitions:
steps:
- parallel: &unit-Test
- step:
name: Build and Test
- step:
name: Security Scan
- step: &build-artifact-and-deploy
name: Build Image and Update Helm Chart
- step: &promote-to-env
pipelines:
default:
- parallel: *unit-Test
branches:
sit:
- parallel: *unit-Test
- step:
<<: *build-artifact-and-deploy
deployment: sit
- step:
<<: *promote-to-env
name: Promote to UAT
trigger: manual
deployment: uat
Zuhlke Engineering Asia
Is it good enough for you?
Kevin: No... this API service is mission critical and we need it to be running 24x7 and scale accordingly Kin: Okay, it sounds important and we need something more...
Zuhlke Engineering Asia
Zuhlke Engineering Asia
# #
Zuhlke Engineering Asia
Kin: (slide) Kevin: Okay
Zuhlke Engineering Asia
Kin:
Kevin: Do I always have to pay to even use Kubernetes? Even when I just want to try it on my local machine?
Zuhlke Engineering Asia
Kin: (slide) Kevin: Is that all we need to know about Kubernetes? Kin: hmm... not quite
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Pause for questions Explain Rancher, demo again using K9s
Zuhlke Engineering Asia
Kevin: do we have to create resources manually?
Zuhlke Engineering Asia
kubectl apply -f deployment.yaml
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Helm3 is an imperative templating tool for managing Kubernetes packages called charts.
Kustomize: is a declarative tool, which works with yaml directly and works as a stream editor like sed.
kubectl apply -k environment/sit
Zuhlke Engineering Asia
service.yaml
Kin:
{{- define "library-chart.service.tpl" -}}
{{- $requiredMsg := include "library-chart.default-check-required-msg" . -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "library-chart.name" . }}
labels:
{{- include "library-chart.labels" . | nindent 4 }}
spec:
type: {{ (.Values.service).type | default "ClusterIP" | quote }}
ports:
- port: {{ (.Values.service).port | include "default.port" }}
targetPort: {{ (.Values.service).targetPort | default "8080" }}
protocol: TCP
name: http
selector:
{{- include "library-chart.selectorLabels" . | nindent 4 }}
{{- end -}}
{{- define "library-chart.service" -}}
{{- include "library-chart.util.merge" (append . "library-chart.service.tpl") -}}
{{- end -}}
Zuhlke Engineering Asia
values-sit.yaml
# deployment.yaml
image:
tag: "hello-world-api-poc-ee2a450c"
# service.yaml
service:
path: sample-api
# deployment.yaml
replicas: 1
# configmap.yaml
config:
application.yml: |-
greeting:
message: Say Hello to the World 123
farewell:
message: Say Goodbye
Zuhlke Engineering Asia
Zuhlke Engineering Asia
What is GitOps?
What is GitOps used for?
How does GitOps work?
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Zuhlke Engineering Asia
Zuhlke Engineering Asia