Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use K8S technology stack to make basic mirror image and experiment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to use the K8S technology stack for basic mirror production and experiments. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it with the editor.

To put it bluntly, the host function provided by any CVM manufacturer to users is a running instance of the basic image of the operating system. Therefore, this blog post will explain how to build a local centos base package image with ssh components and upload it to docker hub for download.

Docker hub registration

Registration address: https://hub.docker.com/

Log in to docker hub from the command line

Enter: docker login on the command line

Make a centos7.4 image

# * 1. Step 1: * * pull the latest basic centos image from the remote end and create it based on this image.

Docker pull centos

# * * 2. Step 2: * * start the docker container

Docker run-it centos:latest / bin/bash

# * * 3. Step 3: * * install sshd in the launched container

Yum-y install openssh-serveryum-y install openssh-clients

# * 4. Step 4: * * Let's try to start the sshd service and we will find an error

Start the sshd service command: / usr/sbin/sshd-D reports the following error:

Could not load host key: / etc/ssh/ssh_host_rsa_keyCould not load host key: / etc/ssh/ssh_host_ecdsa_keyCould not load host key: / etc/ssh/ssh_host_ed25519_key

Let's solve the above mistakes:

Ssh-keygen-t rsa-f / etc/ssh/ssh_host_rsa_key-N "" ssh-keygen-t ecdsa-f / etc/ssh/ssh_host_ecdsa_key-N "" ssh-keygen-t ed25519-f / etc/ssh/ssh_host_ed25519_key-N ""

Starting the sshd service again at this point should be error-free.

# * * 5. Step 5: * * Edit sshd_config configuration file

Execute the command: vim / etc/ssh/sshd_config changes the original UsePAM yes in the configuration file to UsePAM no

# * * 6. Step 6: * * change the password of root

Execute the command: passwd root can enter the password twice

# * * 7. Step 7: * * We use the exit command to exit the container

# * * 8. Step 8: * * based on the container you just exited, let's create a centos image docker commit bf5b84f8e2d8 docker.io/hansonwang/centos7.4_ssh with ssh function.

(1) Note that the bf5b84f8e2d8 here is the id of the container you just ran, which can be viewed with docker ps-a. (2) Note the commit format here, which must be docker.io//centos7.4_ssh.

Push mirroring to the remote end

Docker push docker.io/hansonwang/centos7.4_ssh:latest

Also note that the push format here must be docker.io/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report