设为首页 收藏本站
查看: 1199|回复: 0

[经验分享] [k8s]Docker 用户使用 kubectl 命令指南-unkown排错(kubelet端口解析)

[复制链接]

尚未签到

发表于 2018-1-6 06:10:16 | 显示全部楼层 |阅读模式
[iyunv@m1 yaml]# kubectl run --help  Create and run a particular image, possibly replicated.
  Creates a deployment or job to manage the created container(s).
  Examples:
  # Start a single instance of nginx.
  kubectl run nginx --image=nginx
  # Start a single instance of hazelcast and let the container expose port 5701 .
  kubectl run hazelcast --image=hazelcast --port=5701
  # Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default"
  in the container.
  kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
  # Start a replicated instance of nginx.
  kubectl run nginx --image=nginx --replicas=5
  # Dry run. Print the corresponding API objects without creating them.
  kubectl run nginx --image=nginx --dry-run
  # Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from
  JSON.
  kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
  # Start a pod of busybox and keep it in the foreground, don't restart it if it exits.
  kubectl run -i -t busybox --image=busybox --restart=Never
  # Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
  kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
  # Start the nginx container using a different command and custom arguments.
  kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
  # Start the perl container to compute π to 2000 places and print it out.
  kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
  # Start the cron job to compute π to 2000 places and print it out every 5 minutes.
  kubectl run pi --schedule=&quot;0/5 * * * ?&quot; --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
  Options:
  --allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in
  the template. Only applies to golang and jsonpath output formats.
  --attach=false: If true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...'
  were called.  Default false, unless '-i/--stdin' is set, in which case the default is true. With '--restart=Never' the
  exit code of the container process is returned.
  --command=false: If true and extra arguments are present, use them as the 'command' field in the container, rather
  than the 'args' field which is the default.
  --dry-run=false: If true, only print the object that would be sent, without sending it.
  --env=[]: Environment variables to set in the container
  --expose=false: If true, a public, external service is created for the container(s) which are run
  --generator='': The name of the API generator to use, see
  http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators for a list.
  --hostport=-1: The host port mapping for the container port. To demonstrate a single-machine container.
  --image='': The image for the container to run.
  --image-pull-policy='': The image pull policy for the container. If left empty, this value will not be specified
  by the client and defaulted by the server
  --include-extended-apis=true: If true, include definitions of new APIs via calls to the API server. [default true]
  -l, --labels='': Labels to apply to the pod(s).
  --leave-stdin-open=false: If the pod is started in interactive mode or with stdin, leave stdin open after the
  first attach completes. By default, stdin will be closed after the first attach completes.
  --limits='': The resource requirement limits for this container.  For example, 'cpu=200m,memory=512Mi'.  Note that
  server side components may assign limits depending on the server configuration, such as limit ranges.
  --no-headers=false: When using the default or custom-column output format, don't print headers (default print
  headers).
  -o, --output='': Output format. One of:
  json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...
  See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template
[http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template

[http://kubernetes.io/docs/user-guide/jsonpath].

  --overrides='': An inline JSON override for the generated object. If this is non-empty, it is used to override the
  generated object. Requires that the object supply a valid apiVersion field.
  --pod-running-timeout=1m0s: The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one
  pod is running
  --port='': The port that this container exposes.  If --expose is true, this is also the port used by the service
  that is created.
  --quiet=false: If true, suppress prompt messages.
  --record=false: Record current kubectl command in the resource annotation. If set to false, do not record the
  command. If set to true, record the command. If not set, default to updating the existing annotation value only if one
  already exists.
  -r, --replicas=1: Number of replicas to create for this container. Default is 1.
  --requests='': The resource requirement requests for this container.  For example, 'cpu=100m,memory=256Mi'.  Note
  that server side components may assign requests depending on the server configuration, such as limit ranges.
  --restart='Always': The restart policy for this Pod.  Legal values [Always, OnFailure, Never].  If set to 'Always'
  a deployment is created, if set to 'OnFailure' a job is created, if set to 'Never', a regular pod is created. For the
  latter two --replicas must be 1.  Default 'Always', for CronJobs `Never`.
  --rm=false: If true, delete resources created in this command for attached containers.
  --save-config=false: If true, the configuration of current object will be saved in its annotation. Otherwise, the
  annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
  --schedule='': A schedule in the Cron format the job should be run with.
  --service-generator='service/v2': The name of the generator to use for creating a service.  Only used if --expose
  is true
  --service-overrides='': An inline JSON override for the generated service object. If this is non-empty, it is used
  to override the generated object. Requires that the object supply a valid apiVersion field.  Only used if --expose is
  true.
  -a, --show-all=false: When printing, show all resources (default hide terminated pods.)
  --show-labels=false: When printing, show all labels as the last column (default hide labels column)
  --sort-by='': If non-empty, sort list types using this field specification.  The field specification is expressed
  as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression
  must be an integer or a string.
  -i, --stdin=false: Keep stdin open on the container(s) in the pod, even if nothing is attached.
  --template='': Template string or path to template file to use when -o=go-template, -o=go-template-file. The
  template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
  -t, --tty=false: Allocated a TTY for each container in the pod.
  Usage:
  kubectl run NAME --image=image [--env=&quot;key=value&quot;] [--port=port] [--replicas=replicas] [--dry-run=bool]
[--overrides=inline-json] [--command] -- [COMMAND] [args...] [options]

  Use &quot;kubectl options&quot; for a list of global command-line options (applies to all commands).

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-432081-1-1.html 上篇帖子: k8s cookbook读书笔记 第二章 下篇帖子: 关于K8s集群器日志收集的总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表