K8S 细节
作者:互联网
https://kubernetes.io/zh/docs/reference/kubectl/overview/
https://kubernetes.io/zh/docs/reference/kubectl/overview/#%E8%B5%84%E6%BA%90%E7%B1%B B%E5%9E%8B
https://kubernetes.io/zh/docs/reference/kubectl/overview/#%E6%A0%BC%E5%BC%8F%E5%8C%9 6%E8%BE%93%E5%87%BA
https://kubernetes.io/zh/docs/reference/kubectl/overview/#%E7%A4%BA%E4%BE%8B-%E5%B8% B8%E7%94%A8%E6%93%8D%E4%BD%9C
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
获取部署的tomcat6的yml定义信息
kubectl create deployment tomcat6 --image=tomcat:6.0.53-jre8 --dry-run -o yaml
将配置信息重定向到tomcat6.yaml中(会将上面的信息写入到创建tomcat6.yml中)
kubectl create deployment tomcat6 --image=tomcat:6.0.53-jre8 --dry-run -o yaml > tomcat6.yaml
应用文件创建
kubectl apply -f tomcat6.yaml
此时我们发现创建出了三个副本
我们同样可以获取 pod 的yaml信息 然后输出到文件yaml中
kubectl expose deployment tomcat6 --port=80 --target-port=8080 --type=NodePort --dry-run -o yaml
kubectl expose deployment tomcat6 --port=80 --target-port=8080 --type=NodePort --dry-run -o yaml > tomcat6service.yaml
获取pod信息
kubectl get pod tomcat6-5f7ccf4cb9-frqgh -o yaml
kubectl get pod tomcat6-5f7ccf4cb9-frqgh -o yaml > mypod.yaml vi mypod.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
app: tomcat6-new
name: tomcat6-new
namespace: default
spec:
containers:
- image: tomcat:6.0.53-jre8
imagePullPolicy: IfNotPresent
name: tomcat-new
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx-new
kubectl apply -f mypod.yaml
标签:kubectl,reference,yaml,--,docs,tomcat6,细节,K8S 来源: https://www.cnblogs.com/Lcch/p/16486217.html