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 have encountered a problem. When testing the ed...
0x00 Introduction A few months ago, I found a vul...
This article describes the MySQL single table que...
This collection showcases a number of outstanding ...
Preface The general methods are not listed here, ...
Step 1: Sign a third-party trusted SSL certificat...
Two days ago, I took advantage of the Double 11 s...
Nginx can generally be used for seven-layer load ...
1. Experimental description In the virtual machin...
This article describes how to install mysql5.6 us...
1. pc-reset PC style initialization /* normalize....
We all know that the underlying data structure of...
This article example shares the specific code of ...
1. Basics of Linux Firewall The Linux firewall sy...
concept MMM (Master-Master replication manager fo...