Kubernetes有状态集群服务部署与管理

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Kubernetes有状态集群服务部署与管理Agenda•Background•WhatisKubernetes?•RunstatefulservicesonKubernetes•KubernetesStorage•Volume•PersistentVolume•DynamicStorageProvision•KubernetesStatefulServiceFeatures•InitContainer•PetSet•RunMySQLClusteronKubernetes•GaleraMySQLIntroduction•DeployMySQLClusterwithPetSet•ClusterOperationonKubernetesWhatisKubernetesWhatisKubernetesWhatisKubernetesWhatisKubernetesPetCattleRunStatefulServiceonKubernetes•Statelessservicesarepopularincontainerizedworldbecausetheyaredisposableandeasytobere-createdwithcontainerimages.•Beyondstatelessserviceslikewebserver,usersareincreasinglydeployingstatefulserviceswithcontainerstobenefitfrom“buildonce,runanywhere”andtoimprovebaremetalefficiency/utilization.•These“pets”bringnewrequirementsincludinglongerlifecycle,configurationdependenciesandstatefulfailover.Containerorchestrationmustaddresstheseneedstosuccessfullydeployandscaleapps.RunStatefulServiceonKubernetesStateless•Pod•RC/ReplicaSet•ServiceStateful•Volume•PersistentVolume••••ClusteredPetSetInitContainerHeadlessServiceDynamicStorageProvisionAgenda•Background•WhatisKubernetes?•RunstatefulservicesonKubernetes•KubernetesStorage•Volume•PersistentVolume•DynamicStorageProvision•KubernetesStatefulServiceFeatures•InitContainer•PetSet•RunMySQLClusteronKubernetes•GaleraMySQLIntroduction•DeployMySQLClusterwithPetSet•ClusterOperationonKubernetesKubernetesStorage•NodeBasedVolume•emptyDir•hostPath•UseCases:•Storetempdata•DatasharingamongcontainersKubernetesStorage•hostPath•emptyDirKubernetesStorage•CrossNodeVolumeKubernetesStorageKubernetesClusterSharedVolumeVariousvolumepluginsUnsharedVolumeNodeCCCCNodeCCCCNodeCCCC•••••••emptyDirhostPathgcePersistentDiskawsElasticBlockStoreiscsirbdazureFileVolume•••••••nfshostPathglusterfsflockercephfssecretvsphereVirtualDiskKubernetesStorage•AddyourvolumepluginKubernetesStorage•PersistentVolume&PersistentVolumeClaim•PV/PVCabstractsdetailsofhowstorageisprovidedfromhowitisconsumed.•PV/PVCareAPIresources.•PVsarevolumepluginslikeVolumes,buthavealifecycleindependentofanyindividualpodthatusesthePV.KubernetesStorage•PVAccessModesKubernetesStorage•PVLifecycleProvisioningBindingUsingReleasingReclaimingStaticDynamicAvailableBoundReleasedRetainDeleteRecycleFailedKubernetesStorage•PVProvision&BindingProcesskind:StorageClassapiVersion:storage.k8s.io/v1beta1metadata:name:slowprovisioner:kubernetes.io/gce-pdparameters:type:pd-standardKubernetesStorage•DynamicStorageProvisionkind:StorageClassapiVersion:storage.k8s.io/v1beta1metadata:name:fastprovisioner:kubernetes.io/gce-pdparameters:type:pd-ssdkind:PersistentVolumeClaim,apiVersion:v1,metadata:{name:claim1,annotations:{volume.beta.kubernetes.io/storage-class:fast}},KubernetesStorage•DynamicStorageProvisionspec:{accessModes:[ReadWriteOnce],resources:{requests:{storage:30Gi}}}ThisclaimwillresultinanSSD-likePersistentDiskbeingautomaticallyprovisioned.Whentheclaimisdeleted,thevolumewillbedestroyed.Agenda•Background•WhatisKubernetes?•RunstatefulservicesonKubernetes•KubernetesStorage•Volume•PersistentVolume•DynamicStorageProvision•KubernetesStatefulServiceFeatures•InitContainer•PetSet•RunMySQLClusteronKubernetes•GaleraMySQLIntroduction•DeployMySQLClusterwithPetSet•ClusterOperationonKubernetesInitContainer•WhatisInitContainerSequentiallyexecutedcontainersinapodInitializesharedvolumesAlwaysruntocompletionUsedonapod,replicaset,deployment,daemonset,petsetorjob.InitContainer1SharedVolumesInitContainer2PrimaryContainer••••Pod…InitContainer•WhyInitContainer•••••WaitingforothercomponentstobeavailablePerformingconfigurationRegisteringthepodintoacentraldatabaseDownloadingapplicationdependencies…InitContainerPetSet•PetvsPodPetStatefulIdentityComplexPodStatelessNoIdentitySimplePetSetStableStorageNetworkIdentityOrdinalIndexPetPV/PVCHeadlessServicePetSet••NoClusterIPDNSRecordCreationPetSet•PetSetOperations••••PeerdiscoveryScalingaPetSetImageupgradesDeletingaPetSetAgenda•Background•WhatisKubernetes?•RunstatefulservicesonKubernetes•KubernetesStorage•Volume•PersistentVolume•DynamicStorageProvision•KubernetesStatefulServiceFeatures•InitContainer•PetSet•RunMySQLClusteronKubernetes•GaleraMySQLIntroduction•DeployMySQLClusterwithPetSet•ClusterOperationonKubernetesGaleraMySQLIntroductionHeadlessServiceDeployMySQLClusterwithPetSetPetSetPVPoolInit:installInit:bootstrapContainer:mysqlPVPVPVPVPV…PVCLocalStorageDNSRecordDNSRecordDNSRecord…MySQLPetMySQLPet…DeployMySQLClusterwithPetSetHeadlessService&PetSetDeployMySQLClusterwithPetSetInitContainersDeployMySQLClusterwithPetSetGaleraMySQLContainerDeployMySQLClusterwithPetSetVolumes&PVCCreatePetSetClusterOperation•AutoRecovery•Thefailedpetscanbeautomaticallyrecreated•Thenewcreatedpetwillusethedataofthediedone•ScalingtheCluster•kubectlscalepetsetmysql--replicas=5•ImageUpgrades•UpdatetheimagefieldofanycontainerinthepodTemplate•DeletePetsonebyone,thePetSetcontrollerwillrecreateitwiththenewimageAgenda•Background•WhatisKubernetes?•RunstatefulservicesonKubernetes•KubernetesStorage•Volume•PersistentVolume•DynamicStorageProvision•KubernetesStatef

1 / 37
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功