对K8S的Pod资源进行增删改查基本管理操作
1.推送镜像到harbor仓库
[root@master231 pod]# docker pull nginx:1.25.1-alpine [root@master231 pod]# docker pull nginx:1.24.0-alpine
现在 harbor上 建立项目:
docker tag SOURCE_IMAGE[:TAG] harbor.baimei.com/baimei-web/REPOSITORY[:TAG]
docker tag nginx:1.25.1-alpine harbor.baimei.com/baimei-web/nginx:1.25.1-alpine
推送:
docker push harbor.baimei.com/baimei-web/nginx:1.25.1-alpine
再做另一个镜像:
docker tag nginx:1.24.0-alpine harbor.baimei.com/baimei-web/nginx:1.24.0-alpine
推送:
docker push harbor.baimei.com/baimei-web/nginx:1.24.0-alpine

2.查看所有的资源
kubectl api-resources

3.编写资源清单
cat 02-pods-nginx.yaml
apiVersion: v1
kind: Pod
metadata:
name: baimei-web
spec:
containers:
- name: web
image: harbor.baimei.com/baimei-web/nginx:1.24.0-alpine
4.创建资源
kubectl create -f 02-pods-nginx.yaml

5.查看IP地址并访问
kubectl get pods -o wide

curl -I 10.100.2.3

6.修改资源清单的配置文件
cat 02-pods-nginx.yaml
apiVersion: v1
kind: Pod
metadata:
name: baimei-web
spec:
containers:
- name: web
#image: harbor.baimei.com/baimei-web/nginx:1.24.0-alpine
image: harbor.baimei.com/baimei-web/nginx:1.25.1-alpine

7.删除Pod资源
kubectl get pods

kubectl delete -f 02-pods-nginx.yaml

让windows访问Pod : 连接
欢迎来撩 : 汇总all
