• k8s cookbook读书笔记 第二章


    走一遍概念  

    • An overview of Kubernetes control
    • f Working with pods
    • f Working with a replication controller
    • f Working with services
    • f Working with volumes
    • f Working with secrets
    • f Working with names
    • f Working with namespaces
    • f Working with labels and selectors
    1. An overview of Kubernetes control

    查看k8s版本

      % kubectl version

    是如何做到的

      kubectl通过restful api 连接kubernetes api server

    如何工作的

      kubectl [command] [TYPE] [NAME] [flags]

          /usr/local/bin/kubectl run my-first-nginx --image=nginx

          However, you can write either a YAML file or a JSON file to perform similar operations. 

    # cat nginx.yaml
    apiVersion: v1
    kind: ReplicationController
    metadata:
    name: my-first-nginx
    spec:
    replicas: 1
    template:
    metadata:
    labels:
    app: nginx
    spec:
    containers:
    - name: my-first-nginx
    image: nginx

    Then specify the  create -f option to execute the  kubectl command as follows

    # kubectl create -f nginx.yaml
    replicationcontroller "my-first-nginx" created

     status of the replication controller

    # kubectl get replicationcontrollers
    CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE
    my-first-nginx my-first-nginx nginx app=nginx 1 12s

     缩写

    kubectl get rc
    CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE
    my-first-nginx my-first-nginx nginx app=nginx 1 1m

    删除

    # kubectl delete rc my-first-nginx
    replicationcontroller "my-first-nginx" deleted

    2.pods

       是k8s中最小的可部署单元

       每个pod被进程id,网络,进程间通信,时间命名空间隔离。

       docker pull centos
    # cat my-first-pod.yaml
    apiVersion: v1
    kind: Pod
    metadata:
    name: my-first-pod
    spec:
    containers:
    - name: my-nginx
    image: nginx
    - name: my-centos
    image: centos
    command: ["/bin/sh", "-c", "while : ;do curl http://
    localhost:80/; sleep 3; done"]

       

  • 相关阅读:
    http协议头文件的控制信息 .
    http头文件详解
    java(计算机)常见加密算法详解
    设计模式系列命令模式
    dom对象模型浏览器对象的分层结构图
    验证码实现详解
    JAVA中使用FTPClient实现文件上传下载
    javax.crypto.Cipher类提供加密和解密功能,该类是JCE框架的核心。
    java中的使用RSA算法进行公钥加密私钥解密 .
    Httpservlet源码及实现机制详解
  • 原文地址:https://www.cnblogs.com/guxiaobei/p/8065085.html
Copyright © 2020-2023  润新知