mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
Update console output for Elasticsearch example documentation
This commit is contained in:
parent
715f2c488f
commit
975bd9e1a6
@ -49,7 +49,7 @@ with the basic authentication username and password.
|
|||||||
Here is an example replication controller specification that creates 4 instances of Elasticsearch which is in the file
|
Here is an example replication controller specification that creates 4 instances of Elasticsearch which is in the file
|
||||||
[music-rc.yaml](music-rc.yaml).
|
[music-rc.yaml](music-rc.yaml).
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ReplicationController
|
kind: ReplicationController
|
||||||
metadata:
|
metadata:
|
||||||
@ -103,7 +103,7 @@ for the replication controller (in this case `mytunes`).
|
|||||||
Before creating pods with the replication controller a secret containing the bearer authentication token
|
Before creating pods with the replication controller a secret containing the bearer authentication token
|
||||||
should be set up. A template is provided in the file [apiserver-secret.yaml](apiserver-secret.yaml):
|
should be set up. A template is provided in the file [apiserver-secret.yaml](apiserver-secret.yaml):
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
@ -117,7 +117,7 @@ data:
|
|||||||
Replace `NAMESPACE` with the actual namespace to be used and `TOKEN` with the basic64 encoded
|
Replace `NAMESPACE` with the actual namespace to be used and `TOKEN` with the basic64 encoded
|
||||||
versions of the bearer token reported by `kubectl config view` e.g.
|
versions of the bearer token reported by `kubectl config view` e.g.
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ kubectl config view
|
$ kubectl config view
|
||||||
...
|
...
|
||||||
- name: kubernetes-logging_kubernetes-basic-auth
|
- name: kubernetes-logging_kubernetes-basic-auth
|
||||||
@ -131,7 +131,7 @@ eUdsRGNNdlNaUFg0UHlQMFE1YkhnQVlnaTFpeUVIdjIK=
|
|||||||
|
|
||||||
resulting in the file:
|
resulting in the file:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
@ -144,7 +144,7 @@ data:
|
|||||||
|
|
||||||
which can be used to create the secret in your namespace:
|
which can be used to create the secret in your namespace:
|
||||||
|
|
||||||
```
|
```console
|
||||||
kubectl create -f examples/elasticsearch/apiserver-secret.yaml --namespace=mytunes
|
kubectl create -f examples/elasticsearch/apiserver-secret.yaml --namespace=mytunes
|
||||||
secrets/apiserver-secret
|
secrets/apiserver-secret
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ secrets/apiserver-secret
|
|||||||
|
|
||||||
Now you are ready to create the replication controller which will then create the pods:
|
Now you are ready to create the replication controller which will then create the pods:
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ kubectl create -f examples/elasticsearch/music-rc.yaml --namespace=mytunes
|
$ kubectl create -f examples/elasticsearch/music-rc.yaml --namespace=mytunes
|
||||||
replicationcontrollers/music-db
|
replicationcontrollers/music-db
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ replicationcontrollers/music-db
|
|||||||
It's also useful to have a [service](../../docs/user-guide/services.md) with an load balancer for accessing the Elasticsearch
|
It's also useful to have a [service](../../docs/user-guide/services.md) with an load balancer for accessing the Elasticsearch
|
||||||
cluster which can be found in the file [music-service.yaml](music-service.yaml).
|
cluster which can be found in the file [music-service.yaml](music-service.yaml).
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
@ -181,7 +181,7 @@ spec:
|
|||||||
|
|
||||||
Let's create the service with an external load balancer:
|
Let's create the service with an external load balancer:
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ kubectl create -f examples/elasticsearch/music-service.yaml --namespace=mytunes
|
$ kubectl create -f examples/elasticsearch/music-service.yaml --namespace=mytunes
|
||||||
services/music-server
|
services/music-server
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ services/music-server
|
|||||||
|
|
||||||
Let's see what we've got:
|
Let's see what we've got:
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ kubectl get pods,rc,services,secrets --namespace=mytunes
|
$ kubectl get pods,rc,services,secrets --namespace=mytunes
|
||||||
|
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
@ -208,7 +208,7 @@ apiserver-secret Opaque 1
|
|||||||
|
|
||||||
This shows 4 instances of Elasticsearch running. After making sure that port 9200 is accessible for this cluster (e.g. using a firewall rule for Google Compute Engine) we can make queries via the service which will be fielded by the matching Elasticsearch pods.
|
This shows 4 instances of Elasticsearch running. After making sure that port 9200 is accessible for this cluster (e.g. using a firewall rule for Google Compute Engine) we can make queries via the service which will be fielded by the matching Elasticsearch pods.
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ curl 104.197.12.157:9200
|
$ curl 104.197.12.157:9200
|
||||||
{
|
{
|
||||||
"status" : 200,
|
"status" : 200,
|
||||||
@ -241,7 +241,7 @@ $ curl 104.197.12.157:9200
|
|||||||
|
|
||||||
We can query the nodes to confirm that an Elasticsearch cluster has been formed.
|
We can query the nodes to confirm that an Elasticsearch cluster has been formed.
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ curl 104.197.12.157:9200/_nodes?pretty=true
|
$ curl 104.197.12.157:9200/_nodes?pretty=true
|
||||||
{
|
{
|
||||||
"cluster_name" : "mytunes-db",
|
"cluster_name" : "mytunes-db",
|
||||||
@ -286,7 +286,7 @@ $ curl 104.197.12.157:9200/_nodes?pretty=true
|
|||||||
|
|
||||||
Let's ramp up the number of Elasticsearch nodes from 4 to 10:
|
Let's ramp up the number of Elasticsearch nodes from 4 to 10:
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ kubectl scale --replicas=10 replicationcontrollers music-db --namespace=mytunes
|
$ kubectl scale --replicas=10 replicationcontrollers music-db --namespace=mytunes
|
||||||
scaled
|
scaled
|
||||||
$ kubectl get pods --namespace=mytunes
|
$ kubectl get pods --namespace=mytunes
|
||||||
@ -306,7 +306,7 @@ music-db-zjqyv 1/1 Running 0 1m
|
|||||||
|
|
||||||
Let's check to make sure that these 10 nodes are part of the same Elasticsearch cluster:
|
Let's check to make sure that these 10 nodes are part of the same Elasticsearch cluster:
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ curl 104.197.12.157:9200/_nodes?pretty=true | grep name
|
$ curl 104.197.12.157:9200/_nodes?pretty=true | grep name
|
||||||
"cluster_name" : "mytunes-db",
|
"cluster_name" : "mytunes-db",
|
||||||
"name" : "Killraven",
|
"name" : "Killraven",
|
||||||
|
Loading…
Reference in New Issue
Block a user