Huawei社のクラウドKubernetes管理者研修3宿題

演習1

ポッド使用Redisのミラーを作成する方法によって展開、。Redisのはkubectlをロギングすることで始めます。
名前の展開<hwcka-003-1-你的华为云id>

[root@svn ch03]# kubectl create deploy hwcka-003-1-chenjo --image redis:alpine
deployment.apps/hwcka-003-1-chenjo created

[root@svn ch03]# kubectl get po
NAME                                 READY   STATUS    RESTARTS   AGE
hwcka-003-1-chenjo-98498d48c-rbj2n   1/1     Running   0          10s

[root@svn ch03]# kubectl logs -f hwcka-003-1-chenjo-98498d48c-rbj2n
1:C 22 Jul 2019 09:28:12.262 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 22 Jul 2019 09:28:12.262 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 22 Jul 2019 09:28:12.262 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 22 Jul 2019 09:28:12.264 * Running mode=standalone, port=6379.
1:M 22 Jul 2019 09:28:12.264 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 22 Jul 2019 09:28:12.264 # Server initialized
1:M 22 Jul 2019 09:28:12.264 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this is                                                     sue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be re                                                     started after THP is disabled.
1:M 22 Jul 2019 09:28:12.264 * Ready to accept connections

コマンドYAMLショットを完了します展開、アップロードするために作成

// kubectl create deploy hwcka-003-1-chenjo --image redis:alpine --dry-run -o yaml > ex1.yaml
// cat ex1.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: hwcka-003-1-chenjo
  name: hwcka-003-1-chenjo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hwcka-003-1-chenjo
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: hwcka-003-1-chenjo
    spec:
      containers:
      - image: redis:alpine
        name: redis
        resources: {}
status: {}

2.演習2

コマンドラインは、展開、コピー数3を作成し、ミラーはnginxのです:最新の。1.9.1:その後、nginxのをアップグレードするためにスクロールします。
名前の展開<hwcka-003-2-你的华为云id>

[root@svn ch03]# kubectl run hwcka-003-2-chenjo --replicas 3 --image nginx:latest
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
deployment.apps/hwcka-003-2-chenjo created

[root@svn ch03]# kubectl rollout history deploy hwcka-003-2-chenjo
deployment.extensions/hwcka-003-2-chenjo
REVISION  CHANGE-CAUSE
1         <none>

[root@svn ch03]# kubectl rollout history deploy hwcka-003-2-chenjo --revision 1
deployment.extensions/hwcka-003-2-chenjo with revision #1
Pod Template:
  Labels:       pod-template-hash=67bd474c9
        run=hwcka-003-2-chenjo
  Containers:
   hwcka-003-2-chenjo:
    Image:      nginx:latest
    Port:       <none>
    Host Port:  <none>
    Environment:        <none>
    Mounts:     <none>
  Volumes:      <none>

[root@svn ch03]#

完全な履歴のYAMLと展開アップロードを作成するために使用される情報captureコマンドをアップグレード

// kubectl run hwcka-003-2-chenjo --replicas 3 --image nginx:latest --dry-run -o yaml > ex2.yaml
// cat ex2.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    run: hwcka-003-2-chenjo
  name: hwcka-003-2-chenjo
spec:
  replicas: 3
  selector:
    matchLabels:
      run: hwcka-003-2-chenjo
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        run: hwcka-003-2-chenjo
    spec:
      containers:
      - image: nginx:latest
        name: hwcka-003-2-chenjo
        resources: {}
status: {}

おすすめ

転載: www.cnblogs.com/chenjo/p/11227443.html