httpd部署
创建共享存储目录 yum install -y rpcbind nfs-utils pv创建文档 apiVersion: v1 kind: PersistentVolume metadata: name: httpd-pv spec: capacity: storage: 1Gi accessModes: - ReadWriteOnce nfs: path: /home/sharedir/www server: 192.168.2.120 pvc创建文档 apiVersion: v1 kind: PersistentVolumeClaim metadata: name: httpd-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi httpd创建文件 apiVersion: v1 kind: Service metadata: name: httpd spec: type: NodePort ports: - port: 80 nodePort: 32222 targetPort: 80 selector: app: httpd --- apiVersion: apps/v1 kind: Deployment metadata: name: httpd spec: selector: matchLabels: app: httpd template: metadata: labels: app: httpd spec: containers: - name: httpd image: httpd ports: - name: httpd containerPort: 80 volumeMounts: - name: httpd-persistent-storage mountPath: /usr/local/apache2/htdocs volumes: - name: httpd-persistent-storage persistentVolumeClaim: claimName: httpd-pvc 执行资源创建 查看容器 查看服务 进入httpd容器 访问站点: 修改副本数量 kubectl scale deployment httpd --replicas=2 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |