Get the App
SLTechnology News&Howtos  ›  Servers  › 

Familiarity with the Security Authentication kubernetes Command of docker (40)

Shulou Source: shulou.com Published: 2022-06-02 20:54:23 10月04日 Update

Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!

Original link address: "Advanced article" docker security authentication kubernetes command familiar (40)

We have deployed the secure version of the kubernetes cluster.

Let's use the new cluster to review the commands we have learned before, and then learn about some new commands, new parameters, and new functions.

Familiar with command kubectl version

Kubectl get node

Kubectl get svc

Run a pod

Check pod's log kubectl logs kubernetes-bootcamp-6b7849c495-bqc5r-f

Kubectl run kubernetes-bootcamp--image=jocatalin/kubernetes-bootcamp:v1-- port=8080kubectl get podskubectl get deploykubectl logs kubernetes-bootcamp-6b7849c495-bqc5r-f

Enter the container

Check the details of pod and find that there is a corresponding mount point in pod. When you enter the container, you will find that there is a certificate in the mount point.

Kubectl describe podskubectl exec-it kubernetes-bootcamp-6b7849c495-bqc5r bash

How did these two files in the container come from, crt,namespace,token

If the value in secrets is copied to serviceaccount enabled in pod,apiserver, a default serviceaccount will be created under the namespace of default. After each pod is started, servicesecret will be mounted on the pod as a file.

Kubectl get serviceaccount-o jsonkubectl get secrets-o yaml

Kubectl apply

Nginx-pod.yaml file

ApiVersion: v1kind: Podmetadata: name: nginxspec: containers:-name: nginx image: nginx:1.7.9 ports:-containerPort: 80kubectl apply-f nginx-pod.yaml kubectl get podkubectl describe pods nginx

This has more Anntations than when create was generated. Create is deleted during creation. Apply is overwritten on the basis of the original application and can be rolled back.

Kubectl pulls image to run local kubectl run busybox-- rm=true-- image=busybox-- restart=Never-- tty-I

PS: basically to test whether the security certification k8s can be used normally, and also use several commands. In fact, I feel that the command of kubernetes is very similar to that of docker. The environment is built with a big head, and the back of the boat can be pushed along the river.

Tags: Commands security containers files security authentication authentication that is environment cluster operation advanced push boat along the river function original article original text parameters address foundation big head form Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Redmi OPPO Reno NVidia macOS