您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 销售管理 > 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
本文标题:Kubernetes有状态集群服务部署与管理
链接地址:https://www.777doc.com/doc-1579508 .html