Date post: | 06-May-2023 |
Category: |
Documents |
Upload: | khangminh22 |
View: | 0 times |
Download: | 0 times |
VSTS
Scenario
• Design Practice
• Container Platform
• CI/CD
• Monitor
• One-click deployment
• Spinnaker
• eShopOnContainer
• Security
• Swarm, DC/OS
• CDC
• Hybrid deployment
OPSDEV To be continued…
VSTS
Once the iteration starts, developers
turn great ideas into features…
Scenario – Develop + Test
VSTS
Scenario – Deployment + Release
Cloud
Load Testing
When all tests pass, the build is deployed to testing
environments for each stage in the release process
VSTS
Blue-Green Deployment
• Blue/green deployments are often used for consumer-facing applications and applications with critical uptime requirements. New code is released to the inactive environment, where it is thoroughly tested. Once the code has been vetted, the team makes the idle environment active, typically by adjusting a router configuration to redirect application program traffic. The process reverses when the next software iteration is ready for release.
• If problems are discovered after the switch, traffic can be directed back to the idle configuration that still runs the original version. Once the new code has proven itself in production, the team may choose to update code in the idle configuration environment to provide an added measure of capability for disaster recovery.
VSTS
Scenario – Monitor + Operation
Learn and understand how users use your app, how it reacts
and quickly fix issues and bugs
VSTS
• No all-or-nothing toolset
• Selective tool consolidation
• Preserve existing investments through integration
• Traceability
• Extensibility
• Scalability
Peak interest from mixed technology environments
What appeals most to customers?
VSTS
Agile PlanningDelivery plans
Dashboards
Kanban boards
Build and TestGit source control
Continuous integration
Security scanning
Open source compliance
Cloud-based device testing
ReleaseContinuous delivery
Functional testing
Release management
Monitor and LearnApp performance monitoring
Infra & platform monitoring
Diagnostics & debugging
Log analytics
Usage analytics
Mobile crash reporting
Visual Studio Team Services & Azure
Plan +
Track
Monitor +
Learn
DevOps
Release
Develop +
Test
DevOps
VSTS
• VSTS Git
• TFVC
• GitHub
• GitHub Enterprise
• Subversion
• Bitbucket Cloud
• External Git
Build from source control providers
VSTS
Implement Continuous Integration (CI)
• Implement one pipeline for each API with the following tasks:• Build Docker image
• Push Docker image to Azure Container Registry
• Use branch policy with the following settings:• Protect the master branch
• Add code reviewers (at least 2 for the challenge)
• Do not allow the author to approve their own changes
VSTS
• Add unit testing in your workflow
• The unit tests already exist in the repo
• Each language has a different implementation of unit testing
• Use the result of the unit test as a gate for merging changes
• You need to create a new pipeline to run the unit tests
• Run only on commits that are on feature branches
Implement Unit Testing
VSTS
Implement Continuous Deployment (CD)
• Create a Release pipeline• Trigger based on artifacts from build
published
• Do not forget to add publish artifacts at the end of the build pipeline
• Add two tasks in one stage• Install Helm
• Upgrade the API
• Note the values to be set. They are the same from the deployment script used.
VSTS
Implement monitoring solution for APIs• Add monitoring to AKS:
• Create a “Log Analytics” workspace in the azure subscription
• Enable Monitoring for AKS from the property page of the AKS resource
• Obtain the response time of an API:
• The time to execute a query is written on stdout of each container
• Use Kusto to query and filter the data
• Use Azure Dashboard to expose the graph
VSTS
Implement monitoring solution for APIs
• Create an action group• Use action groups to execute actions
when an alert is raised.
• Use Logic Apps to simplify the connection with Azure DevOps
VSTS
Implement Integration testing, code coverage Load testing
• Load testing as part of the release pipeline• Leverage the “Cloud-based Web
Performance Test” task.
• Must run on a windows agent
• Run the load test simultaneously from the helm upgrade to observe any performance issue and rollback if needed.
VSTS
Deploy K8S cluster with acs-engine
• Install acs-engine(download binary or build from source)
• Generate templates by consuming a cluster definition which outlines the desired shape, size and configuration of K8S
• Generate an SSH key
• Create a Service Principal
• Edit cluster definition(dnsPrefix, KeyData, ClientId, secret)
• Generate the templates(apimodel.json / azuredeploy.json /azuredeploy.parameters.json / certificate and access config files)
• Deploy ARM template
• Scale cluster resource(acs-engine generate apimodel.json)
VSTS
API server
Controller
ManagerScheduler
etcd
Store
Cloud
Controller
Self-managed master node(s)
How managed Kubernetes on Azure works
• Automated upgrades, patches
• High reliability, availability
• Easy, secure cluster scaling
• Self-healing
• API server monitoring
• At no charge
Customer VMs
App/
workload
definitionUser
Docker
Pods
Docker
Pods
Docker
Pods
Docker
Pods
Docker
Pods
Schedule pods over
private tunnel
Kubernetes
API endpoint
Azure managed control plane
VSTS
Deploy and manage Kubernetes with ease
Task The old way With Azure
Create a cluster Provision network and VMs
Install dozens of system components including etcd
Create and install certificates
Register agent nodes with control plane
az aks create
Upgrade a cluster Upgrade your master nodes
Cordon/drain and upgrade worker nodes individually
az aks upgrade
Scale a cluster Provision new VMs
Install system components
Register nodes with API server
az aks scale
Azure makes Kubernetes easy
VSTS
CI/CD with OSS Solution
Cluster
BakeBuild/CI Test ARM DeployCommit
CD
Private Docker Registry
Azure Storage Blob
http://139.219.235.115/job/basic-docker-build-deploy-to-K8s/
VSTS
• 201-jenkins-private-registry-k8s.sh• Install tools(docker, kubectl, Git…), copy kube config• jenkins/install_jenkins.sh – install Jenkins/plugins on VM and expose it via port 80• jenkins/add-docker-build-deploy-k8s.sh – prepare job.xml
• Define builder triggers• Insert groovy script – workflow• Add registry credential• Add job into Jenkins
• basic-docker-build-deploy-k8s-job.xml• Git repository url• Private docker registry url• Service name in k8s
• basic-docker-build-deploy-k8s.groovy• 1. Checkout git repo -> 2. Build docker image -> 3. Push docker image to private docker registry -> 4.
Test and Validation -> 5. Deploy to K8S
VSTS
Cluster/Node Monitor
Agent Node 1
Kubelet
cAdvisor
Agent Node 2
Kubelet
cAdvisor
Agent Node 3
Kubelet
cAdvisor
Master Node
Kubelet
cAdvisor
Heapster
Influxdb Grafana
PVCPVC
Azure Disk Azure Disk
Grafana
Pod
Service
PVC
CPU, Memory, Network
• Node Dashboard
• Pod Dashboard
VSTS
Container/App Monitor
Agent Node 1 Agent Node 2 Agent Node 3 Master Node
Elasticsearch
-master
Elasticsearch
-data-1Kibana
PVC PVC
Azure DiskAzure Disk
Kibana
Pod
Service
PVC
Container log
Service heartbeat
Filebeat
/var/logs/container
Filebeat
/var/logs/container
Filebeat
/var/logs/container
Filebeat
/var/logs/container
LogstashElasticsearch
-master
Elasticsearch
-data-0
Elasticsearch
-master
Elasticsearch
-clientElasticsearch
-client
Elasticsearch
Pod
(DaemonSet)
VSTS
https://docs.microsoft.com/en-us/azure/devops/user-guide/about-azure-devops-services-tfs?view=azure-devops
https://azure.microsoft.com/en-us/pricing/details/devops/azure-devops-services/
VSTS
• Componentization via Services(服务而非组件)• Organized around Business Capabilities(围绕业务组织团队)• Products not Projects
• Smart endpoints and dumb pipes(智能端点与傻瓜管道)• Decentralized Governance(技术选型多样性和服务契约)• Decentralized Data Management
• Infrastructure Automation(CI/CD,自动化测试和运维)• Design for failure
• Evolutionary Design(演进式设计)
Azure DevOps Summary