发布时间: 2023-6-20 文章作者: myluzh 分类名称: Kubernetes 朗读文章
apiVersion: apps/v1 kind: StatefulSet metadata: name: mongodb spec: serviceName: mongodb replicas: 3 selector: matchLabels: app: mongodb template: metadata: labels: app: mongodb spec: containers: - name: mongo image: mongo:4.4 # IfNotPresent 仅本地没有镜像时才远程拉,Always 永远都是从远程拉,Never 永远只用本地镜像,本地没有则报错 imagePullPolicy: IfNotPresent --- apiVersion: v1 kind: Service metadata: name: mongodb spec: selector: app: mongodb type: ClusterIP # HeadLess clusterIP: None ports: - port: 27017 targetPort: 27017应用yaml文件
kubectl apply -f mongo.yaml
标签: k8s kubernetes StatefulSet
发表评论