Environment: (docker, k8s cluster), continue with the image of the java program started by docker last time as an example (https://www.jb51.net/article/189462.htm) Push the created image to Docker's private repository docker tag demo-img:latest localhost:5000/demo-img:1.0 docker push localhost:5000/demo-img:1.0 k8s deploys the image k8s creates a namespace and secret Create a namespace cl-test. Define the name according to your own naming convention. I use this for testing. kubectl create namespace cl-test After creating ns, we need to create a secret for this ns
The console returns "secret/regcred created" to indicate successful creation. Create a yaml file for the demo service. We put service and deployment in one yaml file. --- apiVersion: v1 kind: Service metadata: name: demo-service namespace: cl-test labels: app: demo-service spec: type: NodePort ports: - port: 8701 targetPort: 8701 protocol: TCP name: http selector: app: demo-pod --- apiVersion: apps/v1 kind: Deployment metadata: name: demo-deployment namespace: cl-test spec: selector: matchLabels: app: demo-pod replicas: 1 template: metadata: labels: app: demo-pod spec: containers: - name: demo-container image: localhost:5000/demo-img:1.0 #The image name + version of the local private image library ports: - containerPort: 8701 start up kubectl create -f demo.yaml View Pods kubectl get pod -n cl-test Check the pod log, which is exactly the log we displayed when Java was started before This is the end of this article about the implementation of k8s deployment of docker containers. For more relevant k8s deployment docker content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: JavaScript Basics Series: Functions and Methods
>>: Detailed explanation of non-primary key column overflow monitoring in MySQL tables
I plan to use C/C++ to implement basic data struc...
Table of contents The order in which MySQL reads ...
Preface: Timestamp fields are often used in MySQL...
This article mainly introduces: using Vue to impl...
Table of contents JSON.parse JSON.parse Syntax re...
This article shares the specific code of js to ac...
Many people have encountered this error when star...
Table of contents 1. How to obtain different view...
The project requirements are: select date and tim...
1.1 Data Type Overview The data type is a field c...
1. Rounded Corners Today's web designs are con...
How to add a loading animation every time I scrol...
In the previous blog, Xiao Xiong updated the meth...
IIS7 needs to confirm whether the "URL REWRI...
1. Introduction WHMCS provides an all-in-one solu...