Kubernetes Message Version Demo

Source: Internet
Author: User
Tags etcd k8s

Kubernates Hello World
1 Shutting down the firewall

$systemctl Disable Firewalld$systemctl Stop FIREWALLD

2 Installing ETCD and Kubernates

$yum install-y Etcd kubernates

3 Modifying the configuration

Docker/etc/sysconfig/docker
Options= '--registry-mirror=http://06ec3c30.m.daocloud.io--selinux-enabled=false--insecure-registry gcr.io '
Kubernetes Apiserver/etc/kubernates/apiserver
ServiceAccount deletion in the--admission-control parameter

4 Sequential start

$systemctl start Etcd$systemctl start Docker $systemctl start Kube-apiserver$systemctl start Kube- controller-manager$systemctl start kube-scheduler$systemctl start kubelet$systemctl start Kube- Proxy

Stand-alone version of k8s construction completed

Hello Word Message Board system
Dependent on three mirrors:
Docker.io/kubeguide/guestbook-php-frontend Web Front End
Docker.io/kubeguide/redis-master Write a message
Docker.io/kubeguide/guestbook-redis-slave Read Message

1 Creating master pods and services
Writing Redis-master-controller.yaml

apiVersion:v1kind:ReplicationControllermetadata:  name:redis-Master  Labels:    name:redis -masterspec:  2  selector:    name:redis-Master  Template:    metadata:      Labels:        name:redis-Master    Spec:      containers:      -  Name:master        image:kubeguide/redis-Master        ports:        6379

Publish to K8s Cluster

$kubectl create-f Redis-master-controller.yaml

View

Get Rccontroller CONTAINER (s) IMAGE (s) SELECTOR replicas Ageredis 1  Get  poname ready STATUS Restarts Ageredis1/17 20d

Create a service corresponding to it
Writing Redis-master-service.yaml

apiVersion:v1kind:Servicemetadata:  name:redis-Master  Labels:    name:redis-  Masterspec:  ports:  6379    6379  selector:    name: Redis-master
$kubectl create-f redis-master-get  svcname cluster_ip external_ip PORT (S) SELECTOR Ageredis  10.254. 38.83 6379/tcp name=redis-master 20d

2 creating redis-salve pods and services

Writing Redis-slave-controller.yaml

apiVersion:v1kind:ReplicationControllermetadata:  name:redis-slave  Labels:    name:redis -slavespec:  2  selector:    name:redis-slave  Template:    metadata:      Labels:        name:redis-slave    spec:      containers:      -  Name:slave        image:kubeguide/guestbook-redis-slave        env:        - Name:get_hosts_ From          value:env        ports:        6379

Publish to K8s Cluster

$kubectl create-f redis-master-getget pod

Create a service corresponding to it

Writing Redis-slave-service.yaml

apiVersion:v1kind:Servicemetadata:  name:redis-slave  Labels:    name:redis-  Slavespec:  ports:  6379  selector:    name:redis-slave
$kubectl create-f redis-slave-get Svc

3 Creating frontend pods and services

Writing Frontend-controller.yaml

apiVersion:v1kind:ReplicationControllermetadata:  name:frontend  Labels:    name:frontendspec:   3  selector:    name:frontend  Template:    metadata:      Labels:        name: Frontend    Spec:      containers:      - name:frontend        image:kubeguide/guestbook-php- frontend        env:        - name:get_hosts_from          value:env        ports:        80 

Publish to K8s Cluster

$kubectl create-f frontend-getget pod

Create a service corresponding to it

Writing Frontend-service.yaml

apiVersion:v1kind:Servicemetadata:  name:frontend  Labels:    name:frontedspec:  type:nodeport  Ports:    the 30001 selector  :    name:frontend      

Create a service

$kubectl create-f Frontend-service.yaml

View

Get Svc

4 access via browser
localhost:30001

Note k8s requires container gcr.io/google_containers/pause

Kubernetes Message Version Demo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.