admin 管理员组

文章数量: 887021


2024年1月17日发(作者:go语言高级教程)

[root@k8s-master01 ingress]# cat

apiVersion: v1kind: Servicemetadata: name: myapp namespace: defaultspec: selector: app: myapp release: canary ports: - name: http port: 80 targetPort: 80---apiVersion: apps/v1kind: Deploymentmetadata:

name: myapp-deployspec: replicas: 5 selector:

matchLabels: app: myapp release: canary template: metadata: labels: app: myapp release: canary spec: containers: - name: myapp image: ikubernetes/myapp:v2 ports: - name: httpd containerPort: 80

创建相关服务及检查状态是否就绪

[root@k8s-master ingress-nginx]# kubectl apply -f

service "myapp" "myapp-deploy" created[root@k8s-master ingress-nginx]# kubectl get podsNAME READY STATUS RESTARTS AGEmyapp-deploy-5cfd895984-ffzm5 1/1 Running 0 1mmyapp-deploy-5cfd895984-ftg9t 1/1 Running 0 1mmyapp-deploy-5cfd895984-jg887 1/1 Running 0 1mmyapp-deploy-5cfd895984-mk4jq 1/1 Running 0 1mmyapp-deploy-5cfd895984-nqz6s 1/1 Running 0 1mmyweb-hrfqm 1/1 Running 0 8dmyweb-pb5tb 1/1 Running 0 8dmyweb-xrk22 1/1 Running 0 8d[root@k8s-master ingress-nginx]# kubectl get svcNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEkubernetes ClusterIP 10.96.0.1 443/TCP 9dmyapp ClusterIP 10.102.30.215 80/TCP 1mmyweb NodePort 10.106.138.244 8080:31888/TCP 8d


本文标签: 语言 检查 状态 服务 相关