I try to implement an example of Spring Boot with Couchbase. After implementing docker process, I passed Kubernetes one.
I have some problems when I run kubectl apply -f k8s
command after starting minikube and opening its dashboard.
Couchbase throws this issue shown below
Failed to pull image "couchbase:latest": rpc error: code = Unknown desc = context deadline exceeded
The app named todowithcouchbase throws this issue shown below
Failed to pull image "noyandocker/todowithcouchbase:latest": rpc error: code = Unknown desc = context deadline exceeded
The docker image is available through this link
Here are the codes shown below
1 ) app-config.yml
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
COUCHBASE_BUCKET: "todo_list"
COUCHBASE_HOST: "couchbase"
2 ) couchbase-pv.yml
apiVersion: v1
kind: PersistentVolume
metadata:
name: couchbase-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /mnt/data/couchbase
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: couchbase-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
3 ) couchbase-secret.yml
apiVersion: v1
kind: Secret
metadata:
name: couchbase-secret
type: Opaque
data:
username: QWRtaW5pc3RyYXRvcg== # Base64 of 'Administrator'
password: MTIzNDU2 # Base64 of '123456'
4 ) couchbase-secret.yml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: couchbase
spec:
selector:
matchLabels:
app: couchbase
serviceName: couchbase
replicas: 1
template:
metadata:
labels:
app: couchbase
spec:
containers:
- name: couchbase
image: couchbase:latest
ports:
- containerPort: 8091
- containerPort: 11210
env:
- name: COUCHBASE_ADMINISTRATOR_USERNAME
valueFrom:
secretKeyRef:
name: couchbase-secret
key: username
- name: COUCHBASE_ADMINISTRATOR_PASSWORD
valueFrom:
secretKeyRef:
name: couchbase-secret
key: password
- name: COUCHBASE_BUCKET
valueFrom:
configMapKeyRef:
name: app-config
key: COUCHBASE_BUCKET
volumeMounts:
- name: couchbase-storage
mountPath: /opt/couchbase/var
volumes:
- name: couchbase-storage
persistentVolumeClaim:
claimName: couchbase-pvc
---
apiVersion: v1
kind: Service
metadata:
name: couchbase-service
spec:
selector:
app: couchbase
ports:
- name: admin-port
protocol: TCP
port: 8091
targetPort: 8091
- name: data-port
protocol: TCP
port: 11210
targetPort: 11210
type: NodePort
5 ) todowithcouchbase-deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: todowithcouchbase
spec:
replicas: 1
selector:
matchLabels:
app: todowithcouchbase
template:
metadata:
labels:
app: todowithcouchbase
spec:
containers:
- name: todowithcouchbase
image: noyandocker/todowithcouchbase:latest
ports:
- containerPort: 2323
envFrom:
- configMapRef:
name: app-config
- secretRef:
name: couchbase-secret
---
apiVersion: v1
kind: Service
metadata:
name: todowithcouchbase-service
spec:
selector:
app: todowithcouchbase
ports:
- protocol: TCP
port: 2323
targetPort: 2323
type: NodePort
How can I fix the issue?
Here is the repo link : Link
This is related with my network connection speed. When you have a good network connection speed, you cannot encounter this type of error.