Skip to content

Commit 2ef7655

Browse files
committed
Fix build failure by adding example and include files
Signed-off-by: June Yi <gochist@gmail.com>
1 parent d14b898 commit 2ef7655

7 files changed

Lines changed: 126 additions & 3 deletions

File tree

content/zh/docs/reference/tools.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ content_template: templates/concept
1414
---
1515

1616
<!--
17-
{{% capture overview %}}
1817
Kubernetes contains several built-in tools to help you work with the Kubernetes system.
19-
{{% /capture %}}
2018
-->
2119
{{% capture overview %}}
2220
Kubernetes 包含一些内置工具,可以帮助用户更好的使用 Kubernetes 系统。
@@ -102,7 +100,6 @@ Use Kompose to:
102100
* Translate a Docker Compose file into Kubernetes objects
103101
* Go from local Docker development to managing your application via Kubernetes
104102
* Convert v1 or v2 Docker Compose `yaml` files or [Distributed Application Bundles](https://docs.docker.com/compose/bundles/)
105-
{{% /capture %}}
106103
-->
107104
使用 Kompose:
108105

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: job-wq-2
5+
spec:
6+
parallelism: 2
7+
template:
8+
metadata:
9+
name: job-wq-2
10+
spec:
11+
containers:
12+
- name: c
13+
image: gcr.io/myproject/job-wq-2
14+
restartPolicy: OnFailure
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
3+
import time
4+
import rediswq
5+
6+
host="redis"
7+
# Uncomment next two lines if you do not have Kube-DNS working.
8+
# import os
9+
# host = os.getenv("REDIS_SERVICE_HOST")
10+
11+
q = rediswq.RedisWQ(name="job2", host="redis")
12+
print("Worker with sessionID: " + q.sessionID())
13+
print("Initial queue state: empty=" + str(q.empty()))
14+
while not q.empty():
15+
item = q.lease(lease_secs=10, block=True, timeout=2)
16+
if item is not None:
17+
itemstr = item.decode("utf=8")
18+
print("Working on " + itemstr)
19+
time.sleep(10) # Put your actual work here instead of sleep.
20+
q.complete(item)
21+
else:
22+
print("Waiting for work")
23+
print("Queue empty, exiting")
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: audit.k8s.io/v1beta1 # This is required.
2+
kind: Policy
3+
# Don't generate audit events for all requests in RequestReceived stage.
4+
omitStages:
5+
- "RequestReceived"
6+
rules:
7+
# Log pod changes at RequestResponse level
8+
- level: RequestResponse
9+
resources:
10+
- group: ""
11+
# Resource "pods" doesn't match requests to any subresource of pods,
12+
# which is consistent with the RBAC policy.
13+
resources: ["pods"]
14+
# Log "pods/log", "pods/status" at Metadata level
15+
- level: Metadata
16+
resources:
17+
- group: ""
18+
resources: ["pods/log", "pods/status"]
19+
20+
# Don't log requests to a configmap called "controller-leader"
21+
- level: None
22+
resources:
23+
- group: ""
24+
resources: ["configmaps"]
25+
resourceNames: ["controller-leader"]
26+
27+
# Don't log watch requests by the "system:kube-proxy" on endpoints or services
28+
- level: None
29+
users: ["system:kube-proxy"]
30+
verbs: ["watch"]
31+
resources:
32+
- group: "" # core API group
33+
resources: ["endpoints", "services"]
34+
35+
# Don't log authenticated requests to certain non-resource URL paths.
36+
- level: None
37+
userGroups: ["system:authenticated"]
38+
nonResourceURLs:
39+
- "/api*" # Wildcard matching.
40+
- "/version"
41+
42+
# Log the request body of configmap changes in kube-system.
43+
- level: Request
44+
resources:
45+
- group: "" # core API group
46+
resources: ["configmaps"]
47+
# This rule only applies to resources in the "kube-system" namespace.
48+
# The empty string "" can be used to select non-namespaced resources.
49+
namespaces: ["kube-system"]
50+
51+
# Log configmap and secret changes in all other namespaces at the Metadata level.
52+
- level: Metadata
53+
resources:
54+
- group: "" # core API group
55+
resources: ["secrets", "configmaps"]
56+
57+
# Log all other resources in core and extensions at the Request level.
58+
- level: Request
59+
resources:
60+
- group: "" # core API group
61+
- group: "extensions" # Version of group should NOT be included.
62+
63+
# A catch-all rule to log all other requests at the Metadata level.
64+
- level: Metadata
65+
# Long-running requests like watches that fall under this rule will not
66+
# generate an audit event in RequestReceived.
67+
omitStages:
68+
- "RequestReceived"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: nginx
5+
labels:
6+
env: test
7+
spec:
8+
containers:
9+
- name: nginx
10+
image: nginx
11+
imagePullPolicy: IfNotPresent
12+
nodeSelector:
13+
disktype: ssd
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
You need to have a Kubernetes cluster, and the kubectl command-line tool must
2+
be configured to communicate with your cluster. If you do not already have a
3+
cluster, you can create one by using
4+
[Minikube](/docs/getting-started-guides/minikube),
5+
or you can use one of these Kubernetes playgrounds:
6+
7+
* [Katacoda](https://www.katacoda.com/courses/kubernetes/playground)
8+
* [Play with Kubernetes](http://labs.play-with-k8s.com/)

content/zh/includes/user-guide-content-moved.md

Whitespace-only changes.

0 commit comments

Comments
 (0)