Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
433 views
in Technique[技术] by (71.8m points)

kubernetes - How to create Deployment on nginx with custom text in index.html?

How to create in kubernetes deployment on nginx which will create custom index.html?

is there a way how to create custom index.hmtl with a text: "welcome to the lab"? Or its not possible to do that? Or I should use ConfigmaP? Thank you for your time:

question from:https://stackoverflow.com/questions/65863317/how-to-create-deployment-on-nginx-with-custom-text-in-index-html

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To create custom index.hmtl with a text "welcome to the lab", you need to build your own docker image and then by using that image you can create the kubernetes deployment.

containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80

here, in the manifest you are giving the specification of the container, where you used nginx image and you can not change the image as you have no access of the dockerfile by which that image were created.

In your deployment manifest you give two specification, in outer specification you give the replicas which means how many replica of your application need to run. Another specification is the container specification, here you give your application image which can be your own image or others image like nginx, now the when the deployment create successfully and also the pods then you will only see the things that was defined in your used application image. So, you if you want different things than you need different image containing your desired outputs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...