k8s svc yaml

创建 myapp-deploy.yaml 文件

apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deploy
namespace: default
spec:
replicas: 3
selector:
matchLabels:
app: myapp
release: stabel
template:
metadata:
labels:
app: myapp
release: stabel
env: test
spec:
containers:
- name: myapp
  image: wangyanglinux/myapp:v2
  imagePullPolicy: IfNotPresent
  ports:
   - name: http
   containerPort: 80

vim myapp-service.yaml

apiVersion: v1
kind: Service
metadata:
name: myapp
namespace: default
spec:
type: ClusterIP
selector:
app: myapp
release: stabel
ports:
- name: http
port: 80
targetPort: 80

你可能感兴趣的:(kubernetes,kubernetes)