148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}
Chapter 14 ■ Configuring LoggingStarting Elastic SearchIn this section we shall create a replication controller and service for Elasticsearch using the Docker imagegcr.io/google_containers/elasticsearch:1.9. Create an RC definition file es-controller.yaml andcopy the following listing into it.---apiVersion: v1kind: ReplicationControllermetadata:labels:k8s-app: elasticsearch-loggingkubernetes.io/cluster-service: "true"version: v1name: elasticsearch-logging-v1namespace: kube-systemspec:replicas: 2selector:k8s-app: elasticsearch-loggingversion: v1template:metadata:labels:k8s-app: elasticsearch-loggingkubernetes.io/cluster-service: "true"version: v1spec:containers:-image: "gcr.io/google_containers/elasticsearch:1.9"name: elasticsearch-loggingports:-containerPort: 9200name: dbprotocol: TCP-containerPort: 9300name: transportprotocol: TCPresources:limits:cpu: "0.1"requests:cpu: "0.1"volumeMounts:-mountPath: /dataname: es-persistent-storage318
Chapter 14 ■ Configuring Loggingvolumes:-emptyDir: {}name: es-persistent-storageCreate an RC using the definition file:./kubectl create -f es-controller.yamlCreate a service definition file es-service.yaml for the Elasticsearch RC. Expose the service at port9200. The selector labels should match labels in the pod.---apiVersion: v1kind: Servicemetadata:labels:k8s-app: elasticsearch-loggingkubernetes.io/cluster-service: "true"kubernetes.io/name: Elasticsearchname: elasticsearch-loggingnamespace: kube-systemspec:ports:-port: 9200protocol: TCPtargetPort: dbselector:k8s-app: elasticsearch-loggingCreate a service from the definition file:./kubectl create -f es-service.yamlThe RC, pods, and service for Elasticsearch are created in the kube-system namespace and may belisted and described as shown in Figure 14-15.319
- Page 281 and 282: Chapter 11 ■ Using ConfigMapsCrea
- Page 283 and 284: Chapter 11 ■ Using ConfigMapsFigu
- Page 285 and 286: Chapter 11 ■ Using ConfigMapsCrea
- Page 287 and 288: Chapter 11 ■ Using ConfigMapsFigu
- Page 289 and 290: Chapter 11 ■ Using ConfigMapsCons
- Page 291 and 292: Chapter 11 ■ Using ConfigMapsmoun
- Page 293 and 294: CHAPTER 12Using Resource QuotasIn C
- Page 295 and 296: Chapter 12 ■ Using Resource Quota
- Page 297 and 298: Chapter 12 ■ Using Resource Quota
- Page 299 and 300: Chapter 12 ■ Using Resource Quota
- Page 301 and 302: Chapter 12 ■ Using Resource Quota
- Page 303 and 304: Chapter 12 ■ Using Resource Quota
- Page 305 and 306: Chapter 12 ■ Using Resource Quota
- Page 307 and 308: Chapter 12 ■ Using Resource Quota
- Page 309 and 310: Chapter 12 ■ Using Resource Quota
- Page 311 and 312: Chapter 12 ■ Using Resource Quota
- Page 313 and 314: CHAPTER 13Using AutoscalingStarting
- Page 315 and 316: Chapter 13 ■ Using AutoscalingThe
- Page 317 and 318: Chapter 13 ■ Using AutoscalingFig
- Page 319 and 320: Chapter 13 ■ Using Autoscaling./k
- Page 321 and 322: Chapter 13 ■ Using AutoscalingFig
- Page 323 and 324: CHAPTER 14Configuring LoggingLoggin
- Page 325 and 326: Chapter 14 ■ Configuring Logging
- Page 327 and 328: Docker Log FilesChapter 14 ■ Conf
- Page 329 and 330: Chapter 14 ■ Configuring LoggingF
- Page 331: Chapter 14 ■ Configuring LoggingC
- Page 335 and 336: Chapter 14 ■ Configuring LoggingI
- Page 337 and 338: Chapter 14 ■ Configuring LoggingT
- Page 339 and 340: Chapter 14 ■ Configuring Loggingt
- Page 341 and 342: Chapter 14 ■ Configuring LoggingT
- Page 343 and 344: Chapter 14 ■ Configuring LoggingF
- Page 345 and 346: Chapter 14 ■ Configuring LoggingF
- Page 347 and 348: CHAPTER 15Using an HA Master with O
- Page 349 and 350: Chapter 15 ■ Using an HA Master w
- Page 351 and 352: Installing the Network ManagerChapt
- Page 353 and 354: Chapter 15 ■ Using an HA Master w
- Page 355 and 356: Chapter 15 ■ Using an HA Master w
- Page 357 and 358: Chapter 15 ■ Using an HA Master w
- Page 359 and 360: Chapter 15 ■ Using an HA Master w
- Page 361 and 362: Chapter 15 ■ Using an HA Master w
- Page 363 and 364: Chapter 15 ■ Using an HA Master w
- Page 365 and 366: Chapter 15 ■ Using an HA Master w
- Page 367 and 368: Chapter 16 ■ Developing a Highly
- Page 369 and 370: Chapter 16 ■ Developing a Highly
- Page 371 and 372: Chapter 16 ■ Developing a Highly
- Page 373 and 374: Chapter 16 ■ Developing a Highly
- Page 375 and 376: Chapter 16 ■ Developing a Highly
- Page 377 and 378: Chapter 16 ■ Developing a Highly
- Page 379 and 380: Chapter 16 ■ Developing a Highly
- Page 381 and 382: Chapter 16 ■ Developing a Highly
Chapter 14 ■ Configuring Logging
Starting Elastic Search
In this section we shall create a replication controller and service for Elasticsearch using the Docker image
gcr.io/google_containers/elasticsearch:1.9. Create an RC definition file es-controller.yaml and
copy the following listing into it.
---
apiVersion: v1
kind: ReplicationController
metadata:
labels:
k8s-app: elasticsearch-logging
kubernetes.io/cluster-service: "true"
version: v1
name: elasticsearch-logging-v1
namespace: kube-system
spec:
replicas: 2
selector:
k8s-app: elasticsearch-logging
version: v1
template:
metadata:
labels:
k8s-app: elasticsearch-logging
kubernetes.io/cluster-service: "true"
version: v1
spec:
containers:
-
image: "gcr.io/google_containers/elasticsearch:1.9"
name: elasticsearch-logging
ports:
-
containerPort: 9200
name: db
protocol: TCP
-
containerPort: 9300
name: transport
protocol: TCP
resources:
limits:
cpu: "0.1"
requests:
cpu: "0.1"
volumeMounts:
-
mountPath: /data
name: es-persistent-storage
318