In this slide, I introduce the kubernetes and show an example what is CaaS and what it can provides.
Besides, I also introduce how to setup a continuous integration and continuous deployment for the CaaS platform.
4. What is Kubernetes
1. a container platform
2. a microservices platform
3. contaienr-centric management environment
4. orchestrates computing,networking and storage
infrastructure.
https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/#why-do-i-need-
kubernetes-and-what-can-it-do
9. How We Do Before
Kubernetes Cluster
Pod
Containers
Containers
Containers
Pod
Containers
Containers
Containers
DevOps
Developers
kubectl/helm chart
Wait
kubectl/helm chart
10. How We Do Before
Kubernetes Cluster
Pod
Containers
Containers
Containers
Pod
Containers
Containers
Containers
Customers
kubectl/helm chart
Custom operations
1. Repository
2. Volume
3. Job Queue
4. AAA
11. Container as a Service (CaaS)
1. Container management solitions.
2. Use the kubernetes to control the container lifecycle.
3. Provides and easy way to deploy, manage and scale
container-based applications and services.
4. Integrate with your own business logic to provide more
powerful function
12. How We Do After
Kubernetes
Job
Containers
Containers
Containers
Pod
Containers
Containers
ContainersCustomers
kubectl/helm chart
Portal
Application
UI
Infrastructure
JobQueue
Notification
Storage
Network
Container
Registry
Authentication
Authorization
Accounting
14. What We Need?
1. A friendly portal
2. A backend having the ability to control the kubernetes
3. A continuouse pipleline to guerantee the quality and
functionality of the CaaS platform
15. How to Build CaaS
1. Program the frontend portal (not today)
2. Program the backend server to talk to kubernetes
3. Integrate with CI/CD system
DevOps
QA EngineerDeveloper
Deploy
Commit
Test
19. Before We Starting
We must know how Helm/Kubectl works?
How do they communicate with kubernetes?
20. Setup Client Exectue
kubernetes API
server
End
Try to Use Kubectl to Deploy Pod
kubectl apply -f pod.yaml
Credential
$HOME/.kube/config
Parse the yaml file
and send send the
data to the server
Receive the request
and create the Pod.
21. Programming with Golang
We can use the official library to setup the client.
The project client-go is used to talk to a kubernetes cluster
27. type Pod struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the desired behavior of the pod.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
// +optional
Spec PodSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Most recently observed status of the pod.
// This data may not be up to date.
// Populated by the system.
// Read-only.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
// +optional
Status PodStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
29. What We Have Now
1. The ability to talk to kubernetes cluster.
2. We can also implement our business logic with those
kubernetes related opeartions.
3. Provide the REST interface to work with the frontend to
becomd a kubernetes portal.
34. Integration Testing
There’re some third-party solutions need the real kubernetes
cluster, such as Prometheus/Cadvisor,,etc.
So, We need to a real kubernetes cluster for testing.
38. Steps
1. Receive the notification from commit event.
2. Copy the source code and setup the workspace
3. Create the kubernets cluster
4. Execute the testing
5. Destroy the kubernetes cluster
Kubernetes
39. The Challenge (Kubernetes)
1. Ues the GKE (Via Google API)
2. Use the GCE/Ansible
3. Kubeadm
4. Minikube
Remote cluster in the GCP
Local cluster in the CI system.
40. Minikube + Kubeadm
1. Use the minikube with kubeadm as its bootstrapper and also set
vm-driver to none (container mode)
2. It’s better to use the VM-based testing rather than
container-based. since the kubernetes is be installed as the
container, we can avoid some problems of docker-in-docker
46. Proactive
1. Plain yaml configurations or helm chart.
2. The CI system should have the ability to access the
kubernetes cluster and also have the permission to
deploy yaml/helm into kubernetes cluster.
47. Reactive
1. Install related polling solution into kubernetes first.
2. We only push the container image in the CI system
3. Then it detects the update of image and update it.