mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Use example syncer tags instead of hard-coded examples in doc
This commit is contained in:
@@ -146,6 +146,8 @@ For this example we'll be creating a Redis pod with a named volume and volume mo
|
||||
|
||||
Example Redis pod definition with a persistent storage volume ([pod-redis.yaml](pod-redis.yaml)):
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE pod-redis.yaml -->
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
@@ -163,6 +165,9 @@ spec:
|
||||
emptyDir: {}
|
||||
```
|
||||
|
||||
[Download example](pod-redis.yaml)
|
||||
<!-- END MUNGE: EXAMPLE -->
|
||||
|
||||
Notes:
|
||||
- The volume mount name is a reference to a specific empty dir volume.
|
||||
- The volume mount path is the path to mount the empty dir volume within the container.
|
||||
|
@@ -69,6 +69,8 @@ To add a label, add a labels section under metadata in the pod definition:
|
||||
|
||||
For example, here is the nginx pod definition with labels ([pod-nginx-with-label.yaml](pod-nginx-with-label.yaml)):
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE pod-nginx-with-label.yaml -->
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
@@ -84,6 +86,9 @@ spec:
|
||||
- containerPort: 80
|
||||
```
|
||||
|
||||
[Download example](pod-nginx-with-label.yaml)
|
||||
<!-- END MUNGE: EXAMPLE -->
|
||||
|
||||
Create the labeled pod ([pod-nginx-with-label.yaml](pod-nginx-with-label.yaml)):
|
||||
|
||||
```console
|
||||
@@ -108,6 +113,8 @@ Replication controllers are the objects to answer these questions. A replicatio
|
||||
|
||||
For example, here is a replication controller that instantiates two nginx pods ([replication-controller.yaml](replication-controller.yaml)):
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE replication-controller.yaml -->
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
@@ -135,6 +142,9 @@ spec:
|
||||
- containerPort: 80
|
||||
```
|
||||
|
||||
[Download example](replication-controller.yaml)
|
||||
<!-- END MUNGE: EXAMPLE -->
|
||||
|
||||
#### Replication Controller Management
|
||||
|
||||
Create an nginx replication controller ([replication-controller.yaml](replication-controller.yaml)):
|
||||
@@ -164,6 +174,8 @@ Once you have a replicated set of pods, you need an abstraction that enables con
|
||||
|
||||
For example, here is a service that balances across the pods created in the previous nginx replication controller example ([service.yaml](service.yaml)):
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE service.yaml -->
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -183,6 +195,9 @@ spec:
|
||||
app: nginx
|
||||
```
|
||||
|
||||
[Download example](service.yaml)
|
||||
<!-- END MUNGE: EXAMPLE -->
|
||||
|
||||
#### Service Management
|
||||
|
||||
Create an nginx service ([service.yaml](service.yaml)):
|
||||
@@ -271,6 +286,8 @@ The container health checks are configured in the `livenessProbe` section of you
|
||||
|
||||
Here is an example config for a pod with an HTTP health check ([pod-with-http-healthcheck.yaml](pod-with-http-healthcheck.yaml)):
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE pod-with-http-healthcheck.yaml -->
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
@@ -294,6 +311,9 @@ spec:
|
||||
- containerPort: 80
|
||||
```
|
||||
|
||||
[Download example](pod-with-http-healthcheck.yaml)
|
||||
<!-- END MUNGE: EXAMPLE -->
|
||||
|
||||
For more information about health checking, see [Container Probes](../pod-states.md#container-probes).
|
||||
|
||||
|
||||
|
@@ -10,5 +10,5 @@ spec:
|
||||
- name: redis-persistent-storage
|
||||
mountPath: /data/redis
|
||||
volumes:
|
||||
- name: redis-persistent-storage
|
||||
emptyDir: {}
|
||||
- name: redis-persistent-storage
|
||||
emptyDir: {}
|
||||
|
@@ -4,17 +4,17 @@ metadata:
|
||||
name: pod-with-healthcheck
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx
|
||||
# defines the health checking
|
||||
livenessProbe:
|
||||
# an http probe
|
||||
httpGet:
|
||||
path: /_status/healthz
|
||||
port: 80
|
||||
# length of time to wait for a pod to initialize
|
||||
# after pod startup, before applying health checking
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 1
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- name: nginx
|
||||
image: nginx
|
||||
# defines the health checking
|
||||
livenessProbe:
|
||||
# an http probe
|
||||
httpGet:
|
||||
path: /_status/healthz
|
||||
port: 80
|
||||
# length of time to wait for a pod to initialize
|
||||
# after pod startup, before applying health checking
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 1
|
||||
ports:
|
||||
- containerPort: 80
|
||||
|
@@ -4,21 +4,21 @@ metadata:
|
||||
name: nginx-controller
|
||||
spec:
|
||||
replicas: 2
|
||||
# selector identifies the set of pods that this
|
||||
# selector identifies the set of Pods that this
|
||||
# replication controller is responsible for managing
|
||||
selector:
|
||||
name: nginx
|
||||
# template defines the 'cookie cutter' used for creating
|
||||
app: nginx
|
||||
# podTemplate defines the 'cookie cutter' used for creating
|
||||
# new pods when necessary
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
# Important: these labels need to match the selector above
|
||||
# The api server enforces this constraint.
|
||||
name: nginx
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- name: nginx
|
||||
image: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
|
@@ -4,13 +4,13 @@ metadata:
|
||||
name: nginx-service
|
||||
spec:
|
||||
ports:
|
||||
- port: 8000 # the port that this service should serve on
|
||||
# the container on each pod to connect to, can be a name
|
||||
# (e.g. 'www') or a number (e.g. 80)
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
- port: 8000 # the port that this service should serve on
|
||||
# the container on each pod to connect to, can be a name
|
||||
# (e.g. 'www') or a number (e.g. 80)
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
# just like the selector in the replication controller,
|
||||
# but this time it identifies the set of pods to load balance
|
||||
# traffic to.
|
||||
selector:
|
||||
name: nginx
|
||||
app: nginx
|
||||
|
Reference in New Issue
Block a user