Fix build failure by adding example and include files (#10610)
Signed-off-by: June Yi <gochist@gmail.com>
This commit is contained in:
parent
d14b898a91
commit
462f4553e2
|
@ -14,9 +14,7 @@ content_template: templates/concept
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
{{% capture overview %}}
|
|
||||||
Kubernetes contains several built-in tools to help you work with the Kubernetes system.
|
Kubernetes contains several built-in tools to help you work with the Kubernetes system.
|
||||||
{{% /capture %}}
|
|
||||||
-->
|
-->
|
||||||
{{% capture overview %}}
|
{{% capture overview %}}
|
||||||
Kubernetes 包含一些内置工具,可以帮助用户更好的使用 Kubernetes 系统。
|
Kubernetes 包含一些内置工具,可以帮助用户更好的使用 Kubernetes 系统。
|
||||||
|
@ -102,7 +100,6 @@ Use Kompose to:
|
||||||
* Translate a Docker Compose file into Kubernetes objects
|
* Translate a Docker Compose file into Kubernetes objects
|
||||||
* Go from local Docker development to managing your application via Kubernetes
|
* Go from local Docker development to managing your application via Kubernetes
|
||||||
* Convert v1 or v2 Docker Compose `yaml` files or [Distributed Application Bundles](https://docs.docker.com/compose/bundles/)
|
* Convert v1 or v2 Docker Compose `yaml` files or [Distributed Application Bundles](https://docs.docker.com/compose/bundles/)
|
||||||
{{% /capture %}}
|
|
||||||
-->
|
-->
|
||||||
使用 Kompose:
|
使用 Kompose:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: job-wq-2
|
||||||
|
spec:
|
||||||
|
parallelism: 2
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: job-wq-2
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: c
|
||||||
|
image: gcr.io/myproject/job-wq-2
|
||||||
|
restartPolicy: OnFailure
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import time
|
||||||
|
import rediswq
|
||||||
|
|
||||||
|
host="redis"
|
||||||
|
# Uncomment next two lines if you do not have Kube-DNS working.
|
||||||
|
# import os
|
||||||
|
# host = os.getenv("REDIS_SERVICE_HOST")
|
||||||
|
|
||||||
|
q = rediswq.RedisWQ(name="job2", host="redis")
|
||||||
|
print("Worker with sessionID: " + q.sessionID())
|
||||||
|
print("Initial queue state: empty=" + str(q.empty()))
|
||||||
|
while not q.empty():
|
||||||
|
item = q.lease(lease_secs=10, block=True, timeout=2)
|
||||||
|
if item is not None:
|
||||||
|
itemstr = item.decode("utf=8")
|
||||||
|
print("Working on " + itemstr)
|
||||||
|
time.sleep(10) # Put your actual work here instead of sleep.
|
||||||
|
q.complete(item)
|
||||||
|
else:
|
||||||
|
print("Waiting for work")
|
||||||
|
print("Queue empty, exiting")
|
|
@ -0,0 +1,68 @@
|
||||||
|
apiVersion: audit.k8s.io/v1beta1 # This is required.
|
||||||
|
kind: Policy
|
||||||
|
# Don't generate audit events for all requests in RequestReceived stage.
|
||||||
|
omitStages:
|
||||||
|
- "RequestReceived"
|
||||||
|
rules:
|
||||||
|
# Log pod changes at RequestResponse level
|
||||||
|
- level: RequestResponse
|
||||||
|
resources:
|
||||||
|
- group: ""
|
||||||
|
# Resource "pods" doesn't match requests to any subresource of pods,
|
||||||
|
# which is consistent with the RBAC policy.
|
||||||
|
resources: ["pods"]
|
||||||
|
# Log "pods/log", "pods/status" at Metadata level
|
||||||
|
- level: Metadata
|
||||||
|
resources:
|
||||||
|
- group: ""
|
||||||
|
resources: ["pods/log", "pods/status"]
|
||||||
|
|
||||||
|
# Don't log requests to a configmap called "controller-leader"
|
||||||
|
- level: None
|
||||||
|
resources:
|
||||||
|
- group: ""
|
||||||
|
resources: ["configmaps"]
|
||||||
|
resourceNames: ["controller-leader"]
|
||||||
|
|
||||||
|
# Don't log watch requests by the "system:kube-proxy" on endpoints or services
|
||||||
|
- level: None
|
||||||
|
users: ["system:kube-proxy"]
|
||||||
|
verbs: ["watch"]
|
||||||
|
resources:
|
||||||
|
- group: "" # core API group
|
||||||
|
resources: ["endpoints", "services"]
|
||||||
|
|
||||||
|
# Don't log authenticated requests to certain non-resource URL paths.
|
||||||
|
- level: None
|
||||||
|
userGroups: ["system:authenticated"]
|
||||||
|
nonResourceURLs:
|
||||||
|
- "/api*" # Wildcard matching.
|
||||||
|
- "/version"
|
||||||
|
|
||||||
|
# Log the request body of configmap changes in kube-system.
|
||||||
|
- level: Request
|
||||||
|
resources:
|
||||||
|
- group: "" # core API group
|
||||||
|
resources: ["configmaps"]
|
||||||
|
# This rule only applies to resources in the "kube-system" namespace.
|
||||||
|
# The empty string "" can be used to select non-namespaced resources.
|
||||||
|
namespaces: ["kube-system"]
|
||||||
|
|
||||||
|
# Log configmap and secret changes in all other namespaces at the Metadata level.
|
||||||
|
- level: Metadata
|
||||||
|
resources:
|
||||||
|
- group: "" # core API group
|
||||||
|
resources: ["secrets", "configmaps"]
|
||||||
|
|
||||||
|
# Log all other resources in core and extensions at the Request level.
|
||||||
|
- level: Request
|
||||||
|
resources:
|
||||||
|
- group: "" # core API group
|
||||||
|
- group: "extensions" # Version of group should NOT be included.
|
||||||
|
|
||||||
|
# A catch-all rule to log all other requests at the Metadata level.
|
||||||
|
- level: Metadata
|
||||||
|
# Long-running requests like watches that fall under this rule will not
|
||||||
|
# generate an audit event in RequestReceived.
|
||||||
|
omitStages:
|
||||||
|
- "RequestReceived"
|
|
@ -0,0 +1,13 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: nginx
|
||||||
|
labels:
|
||||||
|
env: test
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nginx
|
||||||
|
image: nginx
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
nodeSelector:
|
||||||
|
disktype: ssd
|
|
@ -0,0 +1,8 @@
|
||||||
|
You need to have a Kubernetes cluster, and the kubectl command-line tool must
|
||||||
|
be configured to communicate with your cluster. If you do not already have a
|
||||||
|
cluster, you can create one by using
|
||||||
|
[Minikube](/docs/getting-started-guides/minikube),
|
||||||
|
or you can use one of these Kubernetes playgrounds:
|
||||||
|
|
||||||
|
* [Katacoda](https://www.katacoda.com/courses/kubernetes/playground)
|
||||||
|
* [Play with Kubernetes](http://labs.play-with-k8s.com/)
|
Loading…
Reference in New Issue