Add“memcached deploy with k8s”

This commit is contained in:
timlackhan
2019-09-04 17:23:19 +08:00
committed by ZhongbaoShi
parent 11b3f23e67
commit 91839f8525
3 changed files with 109 additions and 0 deletions
+38
View File
@@ -50,7 +50,45 @@ image](https://hub.docker.com/_/memcached).
docker run --network somenetwork --name memcached-server -d clearlinux/memcached
```
<!-- Optional -->
### Deploy with Kubernetes
This image can also be deployed on a Kubernetes cluster, such as [minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/).The following example YAML files are provided in the repository as reference for Kubernetes deployment:
- [`memcached-deployment.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/memcached/memcached-deployment.yaml): example using default configuration to create a basic memcached service.
- [`memcached-deployment-conf.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/memcached/memcached-deployment-conf.yaml): example using your own custom configuration to create a memcached service.
Steps to deploy memcached on a Kubernetes cluster:
1. If you want to deploy `memcached-deployment.yaml`
```
kubectl create -f memcached-deployment.yaml
```
Or if you want to deploy `memcached-deployment-conf.yaml`
```
kubectl create -f memcached-deployment-conf.yaml
```
2. Install telnet bundle and connect to the service, where 30100 is the port number defined in your service.
```
swupd bundle-add netkit-telnet
telnet <nodeIP> 30100
```
<!-- Required -->
## Build and modify:
The Dockerfiles for all Clear Linux* OS based container images are available at
+36
View File
@@ -0,0 +1,36 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: memcached
spec:
replicas: 1
revisionHistoryLimit: 2
template:
metadata:
labels:
run: memcached
spec:
containers:
- name: memcached
image: docker.io/clearlinux/memcached
ports:
- containerPort: 11211
# -u:USER -p:PORT -c:MAXCONN -m:CACHESIZE
args: ["-u memcached", "-p 11211", "-c 1024", "-m 64"]
---
apiVersion: v1
kind: Service
metadata:
labels:
run: memcached
name: memcached
spec:
type: NodePort
ports:
- port: 11211
protocol: TCP
targetPort: 11211
nodePort: 30100
selector:
run: memcached
+35
View File
@@ -0,0 +1,35 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: memcached
spec:
replicas: 1
revisionHistoryLimit: 2
template:
metadata:
labels:
run: memcached
spec:
containers:
- name: memcached
image: docker.io/clearlinux/memcached
ports:
- containerPort: 11211
---
apiVersion: v1
kind: Service
metadata:
labels:
run: memcached
name: memcached
spec:
type: NodePort
ports:
- port: 11211
protocol: TCP
targetPort: 11211
nodePort: 30100
selector:
run: memcached