1.控制器
1.生成后改改
kubectl create deployment coreqi-api --image=docker.io/fanqi/coreqi_api:latest --dry-run=client -o yaml > /home/coreqi_dm.yaml
2.手撸
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
generation: 1
labels:
app: coreqi-api
name: coreqi-api
namespace: default
resourceVersion: "11682"
uid: cdafc268-9869-4616-a22a-913ca6d1ea57
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: coreqi-api
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: coreqi-api
spec:
containers:
- image: docker.io/fanqi/coreqi_api:latest
imagePullPolicy: IfNotPresent
name: coreqi-api
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status: {}
3.创建并查看结果
kubectl apply -f /home/coreqi_dm.yaml
kubectl get deployment,pods
2.Service
1.生成后改改
kubectl expose deploy coreqi-api --port=6000 --target-port=6001 --type=NodePort -o yaml --dry-run=client > /home/coreqi_svc.yaml
2.手撸
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: coreqi-api
name: coreqi-api
spec:
ports:
- port: 6000
protocol: TCP
targetPort: 6001
selector:
app: coreqi-api
type: NodePort
status:
loadBalancer: {}
3.创建并查看结果
kubectl apply -f /home/coreqi_svc.yaml
kubectl get svc
3.Ingress
1.生成后改改
标签:文件,kubectl,部署,app,yaml,api,coreqi,--,k8s
From: https://www.cnblogs.com/fanqisoft/p/17479975.html