1、Kubernetes有状态集群服务部署与管理Agenda Background What is Kubernetes?Run stateful serviceson Kubernetes Kubernetes Storage Volume Persistent Volume Dynamic StorageProvision Kubernetes Stateful Service Features Init Container Pet Set Run MySQL Cluster on Kubernetes Galera MySQL Introduction Deploy MySQL Cluste
2、r with PetSet Cluster Operation on KubernetesWhat is KubernetesWhat is KubernetesWhat is KubernetesWhat is KubernetesPetCattleRun Stateful Service on Kubernetes Stateless services are popular in containerized worldbecause they are disposable and easy to be re-createdwith container images.Beyond stat
3、eless services like web server,users areincreasingly deploying stateful services with containersto benefit from“build once,run anywhere”and toimprove bare metal efficiency/utilization.These“pets”bring new requirements including longerlife cycle,configuration dependencies and statefulfailover.Contain
4、er orchestration must address theseneeds to successfully deploy and scale apps.Run Stateful Service on KubernetesStateless Pod RCReplica Set ServiceStateful Volume PersistentVolumeClusteredPet SetInit ContainerHeadless ServiceDynamic StorageProvisionAgenda Background What is Kubernetes?Run stateful
5、serviceson Kubernetes Kubernetes Storage Volume Persistent Volume Dynamic StorageProvision Kubernetes Stateful Service Features Init Container Pet Set Run MySQL Cluster on Kubernetes Galera MySQL Introduction Deploy MySQL Cluster with PetSet Cluster Operation on KubernetesKubernetes Storage Node Bas
6、edVolume emptyDir hostPath Use Cases:Store temp data Data sharingamongcontainersKubernetes Storage hostPath emptyDirKubernetes Storage Cross Node VolumeKubernetes StorageKubernetes ClusterShared VolumeVarious volume pluginsUnshared VolumeNodeCCCCNodeCCCCNodeC CCCemptyDirhostPathgcePersistentDiskawsE
7、lasticBlockStoreiscsirbdazureFileVolumenfshostPathglusterfsflockercephfssecretvsphereVirtualDiskKubernetes Storage Add your volume pluginKubernetes Storage Persistent Volume&Persistent Volume Claim PV/PVC abstracts details of how storage is providedfrom how it is consumed.PV/PVC are API resources.PV
8、s are volume plugins like Volumes,but have alifecycle independent of any individual pod that usesthe PV.Kubernetes Storage PV Access ModesKubernetes Storage PV LifecycleProvisioningBindingUsingReleasingReclaimingStaticDynamicAvailableBoundReleasedRetainDeleteRecycleFailedKubernetes Storage PV Provis
9、ion&Binding Processkind:StorageClassapiVersion:storage.k8s.io/v1beta1metadata:name:slowprovisioner:kubernetes.io/gce-pdparameters:type:pd-standardKubernetes Storage Dynamic Storage Provisionkind:StorageClassapiVersion:storage.k8s.io/v1beta1metadata:name:fastprovisioner:kubernetes.io/gce-pdparameters
10、:type:pd-ssdkind:PersistentVolumeClaim,apiVersion:v1,metadata:name:claim1,annotations:volume.beta.kubernetes.io/storage-class:fast,Kubernetes Storage Dynamic Storage Provisionspec:accessModes:ReadWriteOnce,resources:requests:storage:30GiThis claim will result in an SSD-like Persistent Disk beingauto
11、matically provisioned.When the claim is deleted,the volume willbe destroyed.Agenda Background What is Kubernetes?Run stateful serviceson Kubernetes Kubernetes Storage Volume Persistent Volume Dynamic StorageProvision Kubernetes Stateful Service Features Init Container Pet Set Run MySQL Cluster on Ku
12、bernetes Galera MySQL Introduction Deploy MySQL Cluster with PetSet Cluster Operation on KubernetesInit Container What is Init ContainerSequentially executed containers in a podInitialize shared volumesAlways run to completionUsed on a pod,replica set,deployment,daemonset,pet set or job.Init Contain
13、er 1Shared VolumesInit Container 2PrimaryContainerPodInit Container Why Init ContainerWaiting for other components to be availablePerforming configurationRegistering the pod into a central databaseDownloading application dependenciesInit ContainerPet Set Pet vs PodPetStatefulIdentityComplexPodStatel
14、essNoIdentitySimplePet SetStableStorageNetworkIdentityOrdinalIndexPetPV/PVCHeadlessServicePet SetNo Cluster IPDNS RecordCreationPet Set PetSet OperationsPeer discoveryScaling a PetSetImage upgradesDeleting a PetSetAgenda Background What is Kubernetes?Run stateful serviceson Kubernetes Kubernetes Sto
15、rage Volume Persistent Volume Dynamic StorageProvision Kubernetes Stateful Service Features Init Container Pet Set Run MySQL Cluster on Kubernetes Galera MySQL Introduction Deploy MySQL Cluster with PetSet Cluster Operation on KubernetesGalera MySQL IntroductionHeadless ServiceDeploy MySQL Cluster w
16、ith PetSetPet SetPV PoolInit:installInit:bootstrapContainer:mysqlPVPVPVPVPVPVCLocalStorageDNSRecordDNSRecordDNSRecordMySQLPetMySQLPetDeploy MySQL Cluster with PetSetHeadless Service&PetSetDeploy MySQL Cluster with PetSetInit ContainersDeploy MySQL Cluster with PetSetGalera MySQL ContainerDeploy MySQ
17、L Cluster with PetSetVolumes&PVCCreate Pet SetCluster Operation Auto Recovery The failed pets can be automatically recreated The new created pet will use the data of the diedone Scaling the Cluster kubectl scale petset mysql-replicas=5 Image Upgrades Update the image field of any container in thepod
18、Template Delete Pets one by one,the PetSet controller willrecreate it with the new imageAgenda Background What is Kubernetes?Run stateful serviceson Kubernetes Kubernetes Storage Volume Persistent Volume Dynamic StorageProvision Kubernetes Stateful Service Features Init Container Pet Set Run MySQL C
19、luster on Kubernetes Galera MySQL Introduction Deploy MySQL Cluster with PetSet Cluster Operation on KubernetesSummaryClustered Stateful ServiceStorage RequirementCluster RequirementVolumeGaleraMySQLClusterDeploymentPV/PVCStorageClassHeadlessServicePet SetInitContainerKubernetesAutoRecoveryScalingUpgrade
侵权处理QQ:3464097650--上传资料QQ:3464097650
【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。