- 打开Azure门户并登录账号
- 打开命令行窗口操作生产环境集群
- 连接到k8s master命令行创建demo新的集群部署
kubectl delete secret regcred -n boathouse-test
kubectl delete secret regcred -n boathouse-prod
kubectl delete namespace boathouse-test
kubectl delete namespace boathouse-prod
-
登录Portal - 点击创建资源 - 选择Kubernetes Service Portal:https://portal.azure.com/ 订阅:Visual Studio Ultimate
-
特性:自动升级、节点缩放、Master节点不需要维护
aks-engine介绍: https://github.com/Azure/aks-engine/blob/master/docs/tutorials/quickstart.zh-CN.md
集群定义文件介绍:template-tool-config.json https://github.com/Azure/aks-engine/blob/master/docs/topics/clusterdefinitions.zh-CN.md
生成后的模版文件介绍:
- apimodel.json - 集群配置文件(版本、ImageBase、插件)
- azuredeploy.json - 核心的ARM (Azure Resource Model)模板,用来部署Docker集群
- azuredeploy.parameters.json - 部署参数文件,其中的参数可以自定义
创建环境:
K8s创建命令
.\env-generator.ps1 -AzureUserName [username] -AzureUserPwd [Password] -SubscriptionName [subName] -AzureSPApplicationId [id] -AzureSPApplicationKey [key]
已存在K8s环境:ssh localadmin@[ip]
查看命名空间、查看密钥
kubectl get namespaces
kubectl get secret -n boathouse-test
查看Node节点、查看Deployment资源对象、查看ReplicaSet资源对象、查看Pod资源对象与Node的关系
kubectl get nodes -n boathouse-test -o wide
kubectl get deployment -n boathouse-test -o wide
kubectl get rs -n boathouse-test
kubectl get pods -n boathouse-test -o wide
解析YAML文件内容、查看Service负载均衡对应的EndPoint、比较Pod与Service:
查看Service:
kubectl get service -n boathouse-test
kubectl describe service client -n boathouse-test
kubectl get pods -o wide
登录Portal查看对应的Azure创建的LoadBalancer以及Public Id
解析PVC YAML文件内容
查看预定义的SC、查看Provisioner、查看PVC、查看PV、查看PV绑定的Disk
kubectl get sc
kubectl get sc default -o yaml
kubectl get pvc -n boathouse-test
kubectl get pv
kubectl get pv [pvc-name] -n boathouse-test -o yaml
1.创建命名空间:
kubectl create namespace boathouse-test
kubectl create namespace boathouse-prod
2.创建docker-registry-secrets
kubectl create secret docker-registry regcred --docker-server=docker.pkg.github.com --docker-username=[username] --docker-password=[password] --docker-email=info@idcf.io -n boathouse-test
kubectl create secret docker-registry regcred --docker-server=docker.pkg.github.com --docker-username=[username] --docker-password=[password] --docker-email=info@idcf.io -n boathouse-prod
Jenkins地址:http://jenkins.devopshub.cn/ 插件地址:https://plugins.jenkins.io/kubernetes-cd/
测试环境
kubernetesDeploy configs: 'kompose/test/client-deployment.yaml,kompose/test/management-deployment.yaml,kompose/test/product-service-api-deployment.yaml,kompose/test/statistics-service-api-deployment.yaml,kompose/test/statistics-service-worker-deployment.yaml', deleteResource: true, kubeConfig: [path: ''], kubeconfigId: 'creds-test-k8s', secretName: 'regcred', secretNamespace: 'boathouse-dev', ssh: [sshCredentialsId: '*', sshServer: ''], textCredentials: [certificateAuthorityData: '', clientCertificateData: '', clientKeyData: '', serverUrl: 'https://']
kubernetesDeploy configs: 'kompose/test/*', deleteResource: false, kubeConfig: [path: ''], kubeconfigId: 'creds-test-k8s', secretName: 'regcred', secretNamespace: 'boathouse-dev', ssh: [sshCredentialsId: '*', sshServer: ''], textCredentials: [certificateAuthorityData: '', clientCertificateData: '', clientKeyData: '', serverUrl: 'https://']
生产环境
kubernetesDeploy configs: 'kompose/prod/client-deployment.yaml,kompose/prod/management-deployment.yaml,kompose/prod/product-service-api-deployment.yaml,kompose/prod/statistics-service-api-deployment.yaml,kompose/prod/statistics-service-worker-deployment.yaml', deleteResource: true, kubeConfig: [path: ''], kubeconfigId: 'creds-test-k8s', secretName: 'regcred', secretNamespace: 'boathouse-prod', ssh: [sshCredentialsId: '*', sshServer: ''], textCredentials: [certificateAuthorityData: '', clientCertificateData: '', clientKeyData: '', serverUrl: 'https://']
kubernetesDeploy configs: 'kompose/prod/*', deleteResource: false, kubeConfig: [path: ''], kubeconfigId: 'creds-test-k8s', secretName: 'regcred', secretNamespace: 'boathouse-prod', ssh: [sshCredentialsId: '*', sshServer: ''], textCredentials: [certificateAuthorityData: '', clientCertificateData: '', clientKeyData: '', serverUrl: 'https://']
- 有状态应用 && 无头服务
- 集群监控方案(CAdvisor、Heapster、Infulexdb、Grafana)
- 统一日志方案(ELK)
- 灰度发布(ISTIO)