text
stringlengths
0
59.1k
kubectl get pods
```
You can also see the deployment that was created:
```bash
kubectl get deployment
```
You can also scale the deployment to ensure there is two nginx pods running:
```bash
kubectl scale deployment --replicas 2 my-nginx
```
You can now list the pods to see there is two up and running:
```bash
kubectl get pods
```
### Exposing your pods to the internet
On some platforms (for example Google Compute Engine) the kubectl command can integrate with your cloud provider to add a [public IP address](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types) for the pods,
to do this run:
```bash
kubectl expose deployment my-nginx --port=80 --type=LoadBalancer
```
This should print the service that has been created, and map an external IP address to the service. Where to find this external IP address will depend on the environment you run in. For instance, for Google Compute Engine the external IP address is listed as part of the newly created service and can be retrieved by ru...
```bash
kubectl get services
```
In order to access your nginx landing page, you also have to make sure that traffic from external IPs is allowed. Do this by opening a firewall to allow traffic on port 80.
### Cleanup
To delete the two replicated containers, delete the deployment:
```bash
kubectl delete deployment my-nginx
```
### Next: Configuration files
Most people will eventually want to use declarative configuration files for creating/modifying their applications. A [simplified introduction](https://kubernetes.io/docs/user-journeys/users/application-developer/foundational/#section-2)
is given in a different document.
<|endoftext|>
# source: k8s_examples/_archived/https-nginx/nginx-app.yaml type: yaml
apiVersion: v1
kind: Service
metadata:
name: nginxsvc
labels:
app: nginx
spec:
type: NodePort
ports:
- port: 80
protocol: TCP
name: http
- port: 443
protocol: TCP
name: https
selector:
app: nginx
---
apiVersion: v1
kind: ReplicationController
metadata:
name: my-nginx
spec:
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
volumes:
- name: secret-volume
secret:
secretName: nginxsecret
- name: configmap-volume
configMap:
name: nginxconfigmap
containers:
- name: nginxhttps
image: ymqytw/nginxhttps:1.5
command: ["/home/auto-reload-nginx.sh"]
ports:
- containerPort: 443
- containerPort: 80
livenessProbe:
httpGet:
path: /index.html
port: 80