POD
Create an NGINX Pod
1 |
kubectl run nginx --image=nginx |
Generate POD Manifest YAML file (-o yaml). Don’t create it(–dry-run)
1 |
kubectl run nginx --image=nginx --dry-run=client -o yaml |
Deployment
Create a deployment
1 |
kubectl create deployment --image=nginx nginx |
Generate Deployment YAML file (-o yaml). Don’t create it(–dry-run)
1 |
kubectl create deployment --image=nginx nginx --dry-run=client -o yaml |
Save it to a file – (If you need to modify or add some other details)
1 |
kubectl create deployment --image=nginx nginx --dry-run=client -o yaml > nginx-deployment.yaml |
Service
Create a Service named redis-service of type ClusterIP to expose pod redis on port 6379
1 |
kubectl expose pod redis --port=6379 --name redis-service --dry-run=client -o yaml |
Or
1 |
kubectl create service clusterip redis --tcp=6379:6379 --dry-run=client -o yaml |
Create a Service named nginx of type NodePort to expose pod nginx’s port 80 on port 30080 on the nodes:
1 |
kubectl expose pod nginx --port=80 --name nginx-service --type=NodePort --dry-run=client -o yaml |
Or
1 |
kubectl create service nodeport nginx --tcp=80:80 --node-port=30080 --dry-run=client -o yaml |
Latest posts by Zhiming Zhang (see all)
- 限制读取s3的某个文件夹下文件的权限 - 4月 14, 2021
- cli 批量restore s3DEEP_ARCHIVE - 4月 13, 2021
- 什么是gitops - 3月 25, 2021