kubernetes之kubectl与YAML详解1( 九 )

用get命令导出已部署资源的配置,然后我们也可以据此修改把不熟悉的,没有的删除掉
[root@mcwk8s03 demo]# kubectl get deployNAMEREADYUP-TO-DATEAVAILABLEAGEnginx-deployment3/33351m[root@mcwk8s03 demo]# kubectl get deploy/nginx-deployment --export -o yamlFlag --export has been deprecated, This flag is deprecated and will be removed in future.apiVersion: extensions/v1beta1kind: Deploymentmetadata:annotations:deployment.kubernetes.io/revision: "1"creationTimestamp: nullgeneration: 1labels:app: nginxname: nginx-deploymentselfLink: /apis/extensions/v1beta1/namespaces/default/deployments/nginx-deploymentspec:progressDeadlineSeconds: 600replicas: 3revisionHistoryLimit: 10selector:matchLabels:app: nginxstrategy:rollingUpdate:maxSurge: 25%maxUnavailable: 25%type: RollingUpdatetemplate:metadata:creationTimestamp: nulllabels:app: nginxspec:containers:- image: nginx:1.14.2imagePullPolicy: IfNotPresentname: nginxports:- containerPort: 80protocol: TCPresources: {}terminationMessagePath: /dev/termination-logterminationMessagePolicy: FilednsPolicy: ClusterFirstrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}terminationGracePeriodSeconds: 30status: {}[root@mcwk8s03 demo]#[root@mcwk8s03 demo]#[root@mcwk8s03 demo]#[root@mcwk8s03 demo]# kubectl get deploy/nginx-deployment --export -o=yamlFlag --export has been deprecated, This flag is deprecated and will be removed in future.apiVersion: extensions/v1beta1kind: Deploymentmetadata:annotations:deployment.kubernetes.io/revision: "1"creationTimestamp: nullgeneration: 1labels:app: nginxname: nginx-deploymentselfLink: /apis/extensions/v1beta1/namespaces/default/deployments/nginx-deploymentspec:progressDeadlineSeconds: 600replicas: 3revisionHistoryLimit: 10selector:matchLabels:app: nginxstrategy:rollingUpdate:maxSurge: 25%maxUnavailable: 25%type: RollingUpdatetemplate:metadata:creationTimestamp: nulllabels:app: nginxspec:containers:- image: nginx:1.14.2imagePullPolicy: IfNotPresentname: nginxports:- containerPort: 80protocol: TCPresources: {}terminationMessagePath: /dev/termination-logterminationMessagePolicy: FilednsPolicy: ClusterFirstrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}terminationGracePeriodSeconds: 30status: {}[root@mcwk8s03 demo]# kubectl get deploy/nginx-deployment --export -o=yaml >myGet.yamlFlag --export has been deprecated, This flag is deprecated and will be removed in future.[root@mcwk8s03 demo]# head -3 myGet.yamlapiVersion: extensions/v1beta1kind: Deploymentmetadata:[root@mcwk8s03 demo]# Pod容器的字段拼写忘记了explain比如我们忘了哪个字段是怎么拼写了可以像下面这样找到
[root@mcwk8s03 demo]# kubectl explain pods.spec.containersKIND:PodVERSION:v1RESOURCE: containers <[]Object>DESCRIPTION:List of containers belonging to the pod. Containers cannot currently beadded or removed. There must be at least one container in a Pod. Cannot beupdated.A single application container that you want to run within a pod.FIELDS:args<[]string>Arguments to the entrypoint. The docker image's CMD is

经验总结扩展阅读