diff --git a/操作文档/1、K8S搭建/创建OpenResty的例子/openresty-deployment.yaml b/操作文档/1、K8S搭建/创建OpenResty的例子/openresty-deployment.yaml deleted file mode 100644 index 21b1ba50..00000000 --- a/操作文档/1、K8S搭建/创建OpenResty的例子/openresty-deployment.yaml +++ /dev/null @@ -1,31 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: openresty-deployment -spec: - replicas: 2 # 根据需求设置副本数量 - selector: - matchLabels: - app: openresty - template: - metadata: - labels: - app: openresty - spec: - containers: - - name: openresty - image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/openresty/openresty:1.25.3.1-5-alpine-fat - ports: - - containerPort: 80 - name: http - - containerPort: 443 - name: https - volumeMounts: - - mountPath: /usr/local/openresty/nginx/conf/lua-scripts - name: lua-scripts-volume - command: ["/bin/bash", "-c"] - args: ["exec /usr/bin/openresty -g 'daemon off;'"] - volumes: - - name: lua-scripts-volume - configMap: - name: openresty-lua-configmap \ No newline at end of file diff --git a/操作文档/1、K8S搭建/创建OpenResty的例子/openresty-service.yaml b/操作文档/1、K8S搭建/创建OpenResty的例子/openresty-service.yaml deleted file mode 100644 index c2457c55..00000000 --- a/操作文档/1、K8S搭建/创建OpenResty的例子/openresty-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: openresty-service -spec: - selector: - app: openresty - ports: - - name: http - port: 80 - targetPort: 80 - - name: https - port: 443 - targetPort: 443 - type: LoadBalancer # 或者 NodePort \ No newline at end of file diff --git a/操作文档/1、K8S搭建/创建OpenResty的例子/创建脚本.txt b/操作文档/1、K8S搭建/创建OpenResty的例子/创建脚本.txt deleted file mode 100644 index 73201e4f..00000000 --- a/操作文档/1、K8S搭建/创建OpenResty的例子/创建脚本.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Deployment -kubectl apply -f deployment.yaml - -#Export Service -kubectl apply -f service.yaml \ No newline at end of file diff --git a/操作文档/1、K8S搭建/搭建k8s集群.md b/操作文档/1、K8S搭建/搭建k8s集群.md index 78350b76..e8fde7c9 100644 --- a/操作文档/1、K8S搭建/搭建k8s集群.md +++ b/操作文档/1、K8S搭建/搭建k8s集群.md @@ -652,9 +652,37 @@ kubectl get pods kubectl get pods ``` +### 四、命令行创建发布与服务 +**1、部署应用** -### 四、管理工具$Kuboard$ +```shell +kubectl create deployment nginx-deployment --image=swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/openresty/openresty:1.25.3.1-5-alpine-fat --replicas=1 --port=80 +``` + +**2、暴露应用服务** + +```shell +kubectl expose deployment nginx-deployment --type=NodePort --port=80 --target-port=80 +``` + +**3、查看集群部署状态** + +```shell +kubectl get deployment,svc +``` + + + +**4、通过公网$ip+NodePort$端口号的方式访问$nginx$服务** + +```shell +http://10.10.14.200:30642 +``` + + + +### 五、管理工具$Kuboard$ **官方文档** @@ -713,7 +741,7 @@ users: ![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202409141357727.png) -### 五、资料 +### 六、资料 **kubeadm部署kubernetes1.29**