Kubernetes for Developers Use Kubernetes to Develop, Test, and Deploy Your Applications with the Help of Containers

Kubernetes provides a means to describe what your application needs and how it should run by orchestrating containers on your behalf to operate your software across a single, dozens, or hundreds of machines. Originally created and open sourced from Google, you can use their technology to help run, t...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
1. Verfasser: Heck, Joseph
Format: E-Book
Sprache:Englisch
Veröffentlicht: Birmingham Packt Publishing, Limited 2018
Packt Publishing Limited
Packt Publishing
Ausgabe:1
Schlagworte:
ISBN:1788834755, 9781788834759
Online-Zugang:Volltext
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Inhaltsangabe:
  • Cover -- Copyright and Credits -- Packt Upsell -- Contributors -- Table of Contents -- Preface -- Chapter 1: Setting Up Kubernetes for Development -- What you need for development -- Optional tools -- Getting a local cluster up and running -- Resetting and restarting your cluster -- Looking at what's built-in and included with Minikube -- Verifying Docker -- Clearing and cleaning Docker images -- Kubernetes concept - container -- Kubernetes resource - Pod -- Namespaces -- Writing your code for Pods and Containers -- Kubernetes resource - Node -- Networks -- Controllers -- Kubernetes resource - ReplicaSet -- Kubernetes resource - Deployment -- Representing Kubernetes resources -- Summary -- Chapter 2: Packaging Your Code to Run in Kubernetes -- Container images -- Container registries -- Making your first container -- Dockerfile commands -- Example - Python/Flask container image -- Building the container -- Running your container -- Pod name -- Port forwarding -- Proxy -- How did the proxy know to connect to port 5000 on the container? -- Getting logs from your application -- Example - Node.js/Express container image -- Building the container -- Running your container -- Port forwarding -- Proxy -- Getting logs from your application -- Tagging your container images -- Summary -- Chapter 3: Interacting with Your Code in Kubernetes -- Practical notes for writing software to run in a container -- Getting options for your executable code -- Practical notes for building container images -- Sending output from your program -- Logs -- Pods with more than one container -- Streaming the logs -- Previous logs -- Timestamps -- More debugging techniques -- Interactive deployment of an image -- Attaching to a running Pod -- Running a second process in a container -- Kubernetes concepts - labels -- Organization of labels -- Kubernetes concepts - selectors
  • Example - integration testing with Python -- PyTest and pytest-dependency -- PyTest fixtures and the python-kubernetes client -- Waiting for state changes -- Accessing the deployment -- Example - integration testing with Node.js -- Node.js tests and dependencies with mocha and chai -- Validating the cluster health -- Deploying with kubectl -- Waiting for the pods to become available -- Interacting with the deployment -- Continuous integration with Kubernetes -- Example - using Minikube with Travis.CI -- Next steps -- Example - using Jenkins and the Kubernetes plugin -- Installing Jenkins using Helm -- Accessing Jenkins -- Updating Jenkins -- Example pipeline -- Next steps with pipelines -- Summary -- Chapter 10: Troubleshooting Common Problems and Next Steps -- Common errors and how to resolve them -- Error validating data -- Navigating the documentation -- ErrImagePull -- CrashLoopBackOff -- Starting and inspecting the image -- Adding your own setup to the container -- No endpoints available for service -- Stuck in PodInitializing -- Missing resources -- Emerging projects for developers -- Linters -- Helm -- ksonnet -- Brigade -- skaffold -- img -- Draft -- ksync -- Telepresence -- Interacting with the Kubernetes project -- Slack -- YouTube -- Stack Overflow -- Mailing lists and forums -- Summary -- Other Books You May Enjoy -- Index
  • SIGTERM in Python -- SIGTERM in Node.js -- Summary -- Chapter 6: Background Processing in Kubernetes -- Job -- CronJob -- A worker queue example with Python and Celery -- Celery worker example -- RabbitMQ and configuration -- Celery worker -- Persistence with Kubernetes -- Volumes -- PersistentVolume and PersistentVolumeClaim -- Stateful Sets -- A Node.js example using Stateful Set -- Custom Resource Definition -- Summary -- Chapter 7: Monitoring and Metrics -- Built-in metrics with Kubernetes -- Kubernetes concept - Quality of Service -- Choosing requests and limits for your containers -- Capturing metrics with Prometheus -- Installing Helm -- Installing Prometheus using Helm -- Viewing metrics with Prometheus -- Installing Grafana -- Using Prometheus to view application metrics -- Flask metrics with Prometheus -- Node.js metrics with Prometheus -- Service signals in Prometheus -- Summary -- Chapter 8: Logging and Tracing -- A Kubernetes concept - DaemonSet -- Installing and using Elasticsearch, Fluentd, and Kibana -- Log aggregation with EFK -- Viewing logs using Kibana -- Filtering by app -- Lucene query language -- Running Kibana in production -- Distributed tracing with Jaeger -- Spans and traces -- Architecture of Jaeger distributed tracing -- Trying out Jaeger -- Example - adding tracing to your application -- Adding a tracing collector to your pod -- Add the libraries and code to generate traces -- Considerations for adding tracing -- Summary -- Chapter 9: Integration Testing -- Testing strategies using Kubernetes -- Reviewing resources needed for testing -- Patterns of using Kubernetes with testing -- Tests local and system-under-test in Kubernetes -- Tests local and system-under-test in Kubernetes namespaces -- Tests in Kubernetes and system-under-test in Kubernetes namespaces -- Simple validation with Bats
  • Viewing labels -- Listing resources with labels using kubectl -- Automatic labels and selectors -- Kubernetes resources - service -- Defining a service resource -- Endpoints -- Service type - ExternalName -- Headless service -- Discovering services from within your Pod -- DNS for services -- Exposing services outside the cluster -- Service type - LoadBalancer -- Service type - NodePort -- Minikube service -- Example service - Redis -- Finding the Redis service -- Using Redis from Python -- Updating the Flask deployment -- Deployments and rollouts -- Rollout history -- Rollout undo -- Updating with the kubectl set command -- Summary -- Chapter 4: Declarative Infrastructure -- Imperative versus declarative commands -- A wall of YAML -- Creating a simple deployment -- Declaring your first application -- ImagePullPolicy -- Audit trail -- Kubernetes resource - Annotations -- Exposing labels and annotations in Pods -- Kubernetes resource - ConfigMap -- Creating a ConfigMap -- Managing ConfigMaps -- Exposing the configuration into your container images -- Environment variables -- Exposing ConfigMap as files inside the container -- Dependencies on ConfigMaps -- Kubernetes resource - Secrets -- Exposing Secrets into a container -- Secrets and security - how secret are the secrets? -- Example - Python/Flask deployment with ConfigMap -- SIDEBAR - JSONPATH -- Using the ConfigMap within Python/Flask -- Summary -- Chapter 5: Pod and Container Lifecycles -- Pod lifecycle -- Container lifecycle -- Deployments, ReplicaSets, and Pods -- Getting a snapshot of the current state -- Probes -- Liveness probe -- Readiness probe -- Adding a probe to our Python example -- Running the Python probes example -- Adding a probe to our Node.js example -- Container lifecycle hooks -- Initialization containers -- Quick interactive testing -- Handling a graceful shutdown
  • Kubernetes for Developers: Use Kubernetes to develop, test, and deploy your applications with the help of containers